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.
-static void send_error (const char *msg);
+static void send_error (int errnum, const char *msg);
void
reply_with_error (const char *fs, ...)
void
reply_with_error (const char *fs, ...)
vsnprintf (err, sizeof err, fs, args);
va_end (args);
vsnprintf (err, sizeof err, fs, args);
va_end (args);
snprintf (buf2, sizeof buf2, "%s: %s", buf1, strerror (err));
snprintf (buf2, sizeof buf2, "%s: %s", buf1, strerror (err));
+ send_error (err, buf2);
-send_error (const char *msg)
+send_error (int errnum, const char *msg)
{
XDR xdr;
char buf[GUESTFS_ERROR_LEN + 200];
{
XDR xdr;
char buf[GUESTFS_ERROR_LEN + 200];
+ err.linux_errno = errnum;
err.error_message = (char *) msg;
if (!xdr_guestfs_message_error (&xdr, &err)) {
err.error_message = (char *) msg;
if (!xdr_guestfs_message_error (&xdr, &err)) {
pr "\
struct guestfs_message_error {
pr "\
struct guestfs_message_error {
+ int linux_errno; /* Linux errno if available. */
string error_message<GUESTFS_ERROR_LEN>;
};
string error_message<GUESTFS_ERROR_LEN>;
};
This could be fixed in the generator by specially marking parameters
and return values which take bytes or other units.
This could be fixed in the generator by specially marking parameters
and return values which take bytes or other units.
-=item Protocol should return errno with error messages.
+=item Library should return errno with error messages.
It would be a nice-to-have to be able to get the original value of
'errno' from inside the appliance along error paths (where set).
It would be a nice-to-have to be able to get the original value of
'errno' from inside the appliance along error paths (where set).
error message string into an errno, see the function error() in
fuse/guestmount.c.
error message string into an errno, see the function error() in
fuse/guestmount.c.
+In libguestfs 1.5.4, the protocol was changed so that the
+Linux errno is sent back from the daemon.
+
=back
=head2 PROTOCOL LIMITS
=back
=head2 PROTOCOL LIMITS