Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From 690eeef9590c7ef1d9d2c31d8c1d5d8071da8c4c Mon Sep 17 00:00:00 2001 |
| 2 | From: Chen Qi <Qi.Chen@windriver.com> |
| 3 | Date: Mon, 26 Feb 2018 17:21:11 +0800 |
| 4 | Subject: [PATCH 18/31] check for missing canonicalize_file_name |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 10 | --- |
| 11 | meson.build | 2 ++ |
| 12 | src/basic/missing_syscall.h | 6 ++++++ |
| 13 | 2 files changed, 8 insertions(+) |
| 14 | |
| 15 | diff --git a/meson.build b/meson.build |
| 16 | index 12811b3f3..f6515e97c 100644 |
| 17 | --- a/meson.build |
| 18 | +++ b/meson.build |
| 19 | @@ -520,6 +520,8 @@ foreach ident : [ |
| 20 | ['kcmp', '''#include <linux/kcmp.h>'''], |
| 21 | ['keyctl', '''#include <sys/types.h> |
| 22 | #include <keyutils.h>'''], |
| 23 | + ['canonicalize_file_name', '''#define _GNU_SOURCE |
| 24 | + #include <stdlib.h>'''], |
| 25 | ['copy_file_range', '''#include <sys/syscall.h> |
| 26 | #include <unistd.h>'''], |
| 27 | ['bpf', '''#include <sys/syscall.h> |
| 28 | diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h |
| 29 | index c938d0d97..308b9472b 100644 |
| 30 | --- a/src/basic/missing_syscall.h |
| 31 | +++ b/src/basic/missing_syscall.h |
| 32 | @@ -31,6 +31,12 @@ static inline int pivot_root(const char *new_root, const char *put_old) { |
| 33 | } |
| 34 | #endif |
| 35 | |
| 36 | +#if !HAVE_CANONICALIZE_FILE_NAME |
| 37 | +static inline char *canonicalize_file_name(const char *path) { |
| 38 | + return realpath(path, NULL); |
| 39 | +} |
| 40 | +#endif |
| 41 | + |
| 42 | /* ======================================================================= */ |
| 43 | |
| 44 | #if !HAVE_MEMFD_CREATE |
| 45 | -- |
| 46 | 2.13.0 |
| 47 | |