diff options
author | Richard Jones <rjones@redhat.com> | 2009-11-26 14:13:27 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-11-26 14:13:55 +0000 |
commit | a86eb0e0d2c67e2153139c681632edc72162b8ed (patch) | |
tree | 981f27b7786dd7ceb49ce43ad37c91d7dd525918 | |
parent | 6699491803962a5dee13997f1cc98f119d7101f4 (diff) | |
download | libguestfs-a86eb0e0d2c67e2153139c681632edc72162b8ed.tar.gz libguestfs-a86eb0e0d2c67e2153139c681632edc72162b8ed.tar.xz libguestfs-a86eb0e0d2c67e2153139c681632edc72162b8ed.zip |
Make realpath call optional, disable it for Windows.
-rw-r--r-- | daemon/configure.ac | 1 | ||||
-rw-r--r-- | daemon/realpath.c | 15 | ||||
-rwxr-xr-x | src/generator.ml | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/daemon/configure.ac b/daemon/configure.ac index 1d335b11..65a14858 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -183,6 +183,7 @@ AC_CHECK_FUNCS([\ ntohl \ ntohs \ posix_fallocate \ + realpath \ removexattr \ setxattr \ statvfs \ diff --git a/daemon/realpath.c b/daemon/realpath.c index f9d08dac..e6c81efb 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -28,6 +28,7 @@ #include <dirent.h> #include "daemon.h" +#include "optgroups.h" #include "actions.h" /* On Windows, NAME_MAX is not defined. */ @@ -35,9 +36,20 @@ #define NAME_MAX FILENAME_MAX #endif +int +optgroup_realpath_available (void) +{ +#ifdef HAVE_REALPATH + return 1; +#else + return 0; +#endif +} + char * do_realpath (const char *path) { +#ifdef HAVE_REALPATH char *ret; CHROOT_IN; @@ -49,6 +61,9 @@ do_realpath (const char *path) } return ret; /* caller frees */ +#else + NOT_AVAILABLE (NULL); +#endif } char * diff --git a/src/generator.ml b/src/generator.ml index 74ff3a82..9e602acd 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -3266,7 +3266,7 @@ matching lines."); This calls the external C<zfgrep -i> program and returns the matching lines."); - ("realpath", (RString "rpath", [Pathname "path"]), 163, [], + ("realpath", (RString "rpath", [Pathname "path"]), 163, [Optional "realpath"], [InitISOFS, Always, TestOutput ( [["realpath"; "/../directory"]], "/directory")], "canonicalized absolute pathname", |