diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-11-09 19:50:13 +0000 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-11-09 19:53:39 +0000 |
commit | 25ff0db3b48ef31e90ea3bfe79f435272536aa95 (patch) | |
tree | e1d2d7e2005fc8cab03cdd532d206702c18ad1dc | |
parent | 2d220f5da2cd25e0fda0c98b98ecb384c1fe5c47 (diff) | |
download | libguestfs-25ff0db3b48ef31e90ea3bfe79f435272536aa95.tar.gz libguestfs-25ff0db3b48ef31e90ea3bfe79f435272536aa95.tar.xz libguestfs-25ff0db3b48ef31e90ea3bfe79f435272536aa95.zip |
fuse: Use guestfs_{push,pop}_error_handler so we can see errors in shutdown.
In the fork (usual) case, we still won't see any errors since stderr
has been redirected to /dev/null, but this way is still a little more
correct.
-rw-r--r-- | fuse/guestmount.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fuse/guestmount.c b/fuse/guestmount.c index 1eb0553b..ec8439ad 100644 --- a/fuse/guestmount.c +++ b/fuse/guestmount.c @@ -395,13 +395,6 @@ main (int argc, char *argv[]) if (guestfs_mount_local_argv (g, argv[optind], &optargs) == -1) exit (EXIT_FAILURE); - /* At the last minute, remove the libguestfs error handler. In code - * above this point, the default error handler has been used which - * sends all errors to stderr. From now on, the FUSE code will - * convert errors into error codes (errnos) when appropriate. - */ - guestfs_set_error_handler (g, NULL, NULL); - /* Daemonize. */ if (do_fork) { pid_t pid; @@ -443,9 +436,18 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* At the last minute, remove the libguestfs error handler. In code + * above this point, the default error handler has been used which + * sends all errors to stderr. From now on, the FUSE code will + * convert errors into error codes (errnos) when appropriate. + */ + guestfs_push_error_handler (g, NULL, NULL); + /* Main loop. */ r = guestfs_mount_local_run (g); + guestfs_pop_error_handler (g); + /* Cleanup. */ if (guestfs_shutdown (g) == -1) r = -1; |