virtiofsd: fix error handling in main()

Neither fuse_parse_cmdline() nor fuse_opt_parse() goes to the right place
to do cleanup.

Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Liu Bo 2019-06-05 08:42:35 +08:00 committed by Dr. David Alan Gilbert
parent 8a792b034d
commit c6de804670

View File

@ -2443,13 +2443,14 @@ int main(int argc, char *argv[])
lo_map_init(&lo.fd_map); lo_map_init(&lo.fd_map);
if (fuse_parse_cmdline(&args, &opts) != 0) { if (fuse_parse_cmdline(&args, &opts) != 0) {
return 1; goto err_out1;
} }
fuse_set_log_func(log_func); fuse_set_log_func(log_func);
use_syslog = opts.syslog; use_syslog = opts.syslog;
if (use_syslog) { if (use_syslog) {
openlog("virtiofsd", LOG_PID, LOG_DAEMON); openlog("virtiofsd", LOG_PID, LOG_DAEMON);
} }
if (opts.show_help) { if (opts.show_help) {
printf("usage: %s [options]\n\n", argv[0]); printf("usage: %s [options]\n\n", argv[0]);
fuse_cmdline_help(); fuse_cmdline_help();
@ -2468,7 +2469,7 @@ int main(int argc, char *argv[])
} }
if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) { if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) {
return 1; goto err_out1;
} }
/* /*