[systemd-devel] [RFC 12/25] shared/missing.h: check for missing canonicalize_file_name

Emil Renner Berthing systemd at esmil.dk
Thu Sep 18 06:24:48 PDT 2014


---
 configure.ac         | 3 ++-
 src/shared/missing.h | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index fb16904..1f2bbd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -301,8 +301,9 @@ LIBS="$save_LIBS"
 
 AC_CHECK_FUNCS([fanotify_init fanotify_mark])
 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
-AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN],
+AC_CHECK_DECLS([gettid, pivot_root, canonicalize_file_name, name_to_handle_at, setns, LO_FLAGS_PARTSCAN],
                [], [], [[
+#include <stdlib.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/mount.h>
diff --git a/src/shared/missing.h b/src/shared/missing.h
index 8389c28..2379950 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -130,6 +130,12 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
 }
 #endif
 
+#if !HAVE_DECL_CANONICALIZE_FILE_NAME
+static inline char *canonicalize_file_name(const char *path) {
+        return realpath(path, NULL);
+}
+#endif
+
 #ifdef __x86_64__
 #  ifndef __NR_fanotify_init
 #    define __NR_fanotify_init 300
-- 
2.1.0



More information about the systemd-devel mailing list