git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Daemon: fix handling of errors from xread and xwrite.
[libguestfs.git]
/
daemon
/
guestfsd.c
diff --git
a/daemon/guestfsd.c
b/daemon/guestfsd.c
index
fad49fb
..
7c4e72e
100644
(file)
--- a/
daemon/guestfsd.c
+++ b/
daemon/guestfsd.c
@@
-233,7
+233,8
@@
main (int argc, char *argv[])
exit (1);
}
exit (1);
}
- (void) xwrite (sock, buf, xdr_getpos (&xdr));
+ if (xwrite (sock, buf, xdr_getpos (&xdr)) == -1)
+ exit (1);
xdr_destroy (&xdr);
xdr_destroy (&xdr);
@@
-273,9
+274,10
@@
sysroot_path (const char *path)
}
int
}
int
-xwrite (int sock, const void *buf, size_t len)
+xwrite (int sock, const void *
v_
buf, size_t len)
{
int r;
{
int r;
+ const char *buf = v_buf;
while (len > 0) {
r = write (sock, buf, len);
while (len > 0) {
r = write (sock, buf, len);
@@
-291,9
+293,10
@@
xwrite (int sock, const void *buf, size_t len)
}
int
}
int
-xread (int sock, void *buf, size_t len)
+xread (int sock, void *
v_
buf, size_t len)
{
int r;
{
int r;
+ char *buf = v_buf;
while (len > 0) {
r = read (sock, buf, len);
while (len > 0) {
r = read (sock, buf, len);
@@
-743,8
+746,6
@@
print_sysroot_shell_quote (FILE *stream,
const struct printf_info *info,
const void *const *args)
{
const struct printf_info *info,
const void *const *args)
{
-#define SAFE(c) (isalnum((c)) || \
- (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.')
fputs (sysroot, stream);
return sysroot_len + print_shell_quote (stream, info, args);
}
fputs (sysroot, stream);
return sysroot_len + print_shell_quote (stream, info, args);
}