git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New API: inspect-get-roots to return roots from last inspection.
[libguestfs.git]
/
daemon
/
realpath.c
diff --git
a/daemon/realpath.c
b/daemon/realpath.c
index
0dc5fa5
..
89f7737
100644
(file)
--- a/
daemon/realpath.c
+++ b/
daemon/realpath.c
@@
-27,25
+27,43
@@
#include <sys/types.h>
#include <dirent.h>
#include <sys/types.h>
#include <dirent.h>
-#include "openat.h"
-
#include "daemon.h"
#include "daemon.h"
+#include "optgroups.h"
#include "actions.h"
#include "actions.h"
+/* On Windows, NAME_MAX is not defined. */
+#ifndef NAME_MAX
+#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)
{
char *
do_realpath (const char *path)
{
+#ifdef HAVE_REALPATH
char *ret;
CHROOT_IN;
ret = realpath (path, NULL);
CHROOT_OUT;
if (ret == NULL) {
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 */
return NULL;
}
return ret; /* caller frees */
+#else
+ NOT_AVAILABLE (NULL);
+#endif
}
char *
}
char *
@@
-80,11
+98,11
@@
do_case_sensitive_path (const char *path)
if ((i == 1 && path[0] == '.') ||
(i == 2 && path[0] == '.' && path[1] == '.')) {
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) {
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;
}
goto error;
}
@@
-113,7
+131,7
@@
do_case_sensitive_path (const char *path)
errno = 0;
while ((d = readdir (dir)) != NULL) {
errno = 0;
while ((d = readdir (dir)) != NULL) {
- if (
strcasecmp (d->d_name, name) == 0
)
+ if (
STRCASEEQ (d->d_name, name)
)
break;
}
break;
}