git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 1.10.10.
[libguestfs.git]
/
daemon
/
realpath.c
diff --git
a/daemon/realpath.c
b/daemon/realpath.c
index
e6c81ef
..
592e12c
100644
(file)
--- a/
daemon/realpath.c
+++ b/
daemon/realpath.c
@@
-1,5
+1,5
@@
/* libguestfs - the guestfsd daemon
/* libguestfs - the guestfsd daemon
- * Copyright (C) 2009 Red Hat Inc.
+ * Copyright (C) 2009
-2011
Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-56,7
+56,7
@@
do_realpath (const char *path)
ret = realpath (path, NULL);
CHROOT_OUT;
if (ret == NULL) {
ret = realpath (path, NULL);
CHROOT_OUT;
if (ret == NULL) {
- reply_with_perror ("
realpath"
);
+ reply_with_perror ("
%s", path
);
return NULL;
}
return NULL;
}
@@
-92,17
+92,13
@@
do_case_sensitive_path (const char *path)
continue;
}
continue;
}
- if (verbose)
- fprintf (stderr, "case_sensitive_path: path = %s, next = %zu, i = %zu\n",
- path, next, i);
-
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;
}
@@
-183,7
+179,8
@@
do_case_sensitive_path (const char *path)
}
}
}
}
- close (fd_cwd);
+ if (fd_cwd >= 0)
+ close (fd_cwd);
ret[next] = '\0';
char *retp = strdup (ret);
ret[next] = '\0';
char *retp = strdup (ret);
@@
-194,6
+191,8
@@
do_case_sensitive_path (const char *path)
return retp; /* caller frees */
error:
return retp; /* caller frees */
error:
- close (fd_cwd);
+ if (fd_cwd >= 0)
+ close (fd_cwd);
+
return NULL;
}
return NULL;
}