summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0018-check-for-missing-canonicalize_file_name.patch
blob: ab7edf5ca4a89bacf4c46165a424f16a1a05ea87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 690eeef9590c7ef1d9d2c31d8c1d5d8071da8c4c Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 26 Feb 2018 17:21:11 +0800
Subject: [PATCH 18/31] check for missing canonicalize_file_name

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meson.build                 | 2 ++
 src/basic/missing_syscall.h | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/meson.build b/meson.build
index 12811b3f3..f6515e97c 100644
--- a/meson.build
+++ b/meson.build
@@ -520,6 +520,8 @@ foreach ident : [
         ['kcmp',              '''#include <linux/kcmp.h>'''],
         ['keyctl',            '''#include <sys/types.h>
                                  #include <keyutils.h>'''],
+        ['canonicalize_file_name', '''#define _GNU_SOURCE
+                                      #include <stdlib.h>'''],
         ['copy_file_range',   '''#include <sys/syscall.h>
                                  #include <unistd.h>'''],
         ['bpf',               '''#include <sys/syscall.h>
diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
index c938d0d97..308b9472b 100644
--- a/src/basic/missing_syscall.h
+++ b/src/basic/missing_syscall.h
@@ -31,6 +31,12 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
 }
 #endif
 
+#if !HAVE_CANONICALIZE_FILE_NAME
+static inline char *canonicalize_file_name(const char *path) {
+        return realpath(path, NULL);
+}
+#endif
+
 /* ======================================================================= */
 
 #if !HAVE_MEMFD_CREATE
-- 
2.13.0