From 25ff0db3b48ef31e90ea3bfe79f435272536aa95 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 9 Nov 2012 19:50:13 +0000 Subject: 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. --- fuse/guestmount.c | 16 +++++++++------- 1 file 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; -- cgit