X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=daemon%2Frealpath.c;h=89f77378d432b05c4bcfe01906ffcd5987847b50;hp=02a82d6a9fa91d6e0162ba53055daa18b13dbb05;hb=428a45c3e15f03e9861e1b551e1ae8da821dba5f;hpb=7d8a3404b27fcd71f84dbe4c022c4435d0070d6b diff --git a/daemon/realpath.c b/daemon/realpath.c index 02a82d6..89f7737 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -27,9 +27,8 @@ #include #include -#include "openat.h" - #include "daemon.h" +#include "optgroups.h" #include "actions.h" /* On Windows, NAME_MAX is not defined. */ @@ -37,20 +36,34 @@ #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; ret = realpath (path, NULL); CHROOT_OUT; if (ret == NULL) { - reply_with_perror ("realpath"); + reply_with_perror ("%s", path); return NULL; } return ret; /* caller frees */ +#else + NOT_AVAILABLE (NULL); +#endif } char * @@ -85,11 +98,11 @@ do_case_sensitive_path (const char *path) if ((i == 1 && path[0] == '.') || (i == 2 && path[0] == '.' && path[1] == '.')) { - reply_with_error ("case_sensitive_path: path contained . or .. elements"); + reply_with_error ("path contained . or .. elements"); goto error; } if (i > NAME_MAX) { - reply_with_error ("case_sensitive_path: path element too long"); + reply_with_error ("path element too long"); goto error; }