summaryrefslogtreecommitdiffstats
path: root/daemon/proto.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-08-23 22:19:24 +0100
committerRichard Jones <rjones@redhat.com>2010-08-24 11:54:42 +0100
commit831b1fc1805e8450202b5c2cf9ab17a163ab0cc5 (patch)
tree497735bd8728fc972be7dd907692cefe5ad3bc84 /daemon/proto.c
parent90d06e28888d9a492560ca986dca0708f881d173 (diff)
downloadlibguestfs-831b1fc1805e8450202b5c2cf9ab17a163ab0cc5.tar.gz
libguestfs-831b1fc1805e8450202b5c2cf9ab17a163ab0cc5.tar.xz
libguestfs-831b1fc1805e8450202b5c2cf9ab17a163ab0cc5.zip
Change protocol to send Linux errno from daemon to library.
This changes the protocol so that the Linux errno (if available) is sent back to the library. Note that the errno is not yet made available to callers, since it is not clear how best to present this Linux-specific number.
Diffstat (limited to 'daemon/proto.c')
-rw-r--r--daemon/proto.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/daemon/proto.c b/daemon/proto.c
index 6fa243ff..628e86c1 100644
--- a/daemon/proto.c
+++ b/daemon/proto.c
@@ -179,7 +179,7 @@ main_loop (int _sock)
}
}
-static void send_error (const char *msg);
+static void send_error (int errnum, const char *msg);
void
reply_with_error (const char *fs, ...)
@@ -191,7 +191,7 @@ reply_with_error (const char *fs, ...)
vsnprintf (err, sizeof err, fs, args);
va_end (args);
- send_error (err);
+ send_error (0, err);
}
void
@@ -207,11 +207,11 @@ reply_with_perror_errno (int err, const char *fs, ...)
snprintf (buf2, sizeof buf2, "%s: %s", buf1, strerror (err));
- send_error (buf2);
+ send_error (err, buf2);
}
static void
-send_error (const char *msg)
+send_error (int errnum, const char *msg)
{
XDR xdr;
char buf[GUESTFS_ERROR_LEN + 200];
@@ -236,6 +236,7 @@ send_error (const char *msg)
exit (EXIT_FAILURE);
}
+ err.linux_errno = errnum;
err.error_message = (char *) msg;
if (!xdr_guestfs_message_error (&xdr, &err)) {