mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user