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.
This commit is contained in:
Richard W.M. Jones
2012-11-09 19:50:13 +00:00
parent 2d220f5da2
commit 25ff0db3b4

View File

@@ -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;