ddf19c
From 0ea1c7375d6509367399c706eb9d1e8cf79a5830 Mon Sep 17 00:00:00 2001
ddf19c
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
ddf19c
Date: Mon, 27 Jan 2020 19:01:55 +0100
ddf19c
Subject: [PATCH 084/116] virtiofsd: fix error handling in main()
ddf19c
MIME-Version: 1.0
ddf19c
Content-Type: text/plain; charset=UTF-8
ddf19c
Content-Transfer-Encoding: 8bit
ddf19c
ddf19c
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
Message-id: <20200127190227.40942-81-dgilbert@redhat.com>
ddf19c
Patchwork-id: 93534
ddf19c
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 080/112] virtiofsd: fix error handling in main()
ddf19c
Bugzilla: 1694164
ddf19c
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ddf19c
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ddf19c
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
ddf19c
ddf19c
From: Liu Bo <bo.liu@linux.alibaba.com>
ddf19c
ddf19c
Neither fuse_parse_cmdline() nor fuse_opt_parse() goes to the right place
ddf19c
to do cleanup.
ddf19c
ddf19c
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
ddf19c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
ddf19c
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
(cherry picked from commit c6de804670f2255ce776263124c37f3370dc5ac1)
ddf19c
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ddf19c
---
ddf19c
 tools/virtiofsd/passthrough_ll.c | 5 +++--
ddf19c
 1 file changed, 3 insertions(+), 2 deletions(-)
ddf19c
ddf19c
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
ddf19c
index 9ed77a1..af050c6 100644
ddf19c
--- a/tools/virtiofsd/passthrough_ll.c
ddf19c
+++ b/tools/virtiofsd/passthrough_ll.c
ddf19c
@@ -2443,13 +2443,14 @@ int main(int argc, char *argv[])
ddf19c
     lo_map_init(&lo.fd_map);
ddf19c
 
ddf19c
     if (fuse_parse_cmdline(&args, &opts) != 0) {
ddf19c
-        return 1;
ddf19c
+        goto err_out1;
ddf19c
     }
ddf19c
     fuse_set_log_func(log_func);
ddf19c
     use_syslog = opts.syslog;
ddf19c
     if (use_syslog) {
ddf19c
         openlog("virtiofsd", LOG_PID, LOG_DAEMON);
ddf19c
     }
ddf19c
+
ddf19c
     if (opts.show_help) {
ddf19c
         printf("usage: %s [options]\n\n", argv[0]);
ddf19c
         fuse_cmdline_help();
ddf19c
@@ -2468,7 +2469,7 @@ int main(int argc, char *argv[])
ddf19c
     }
ddf19c
 
ddf19c
     if (fuse_opt_parse(&args, &lo, lo_opts, NULL) == -1) {
ddf19c
-        return 1;
ddf19c
+        goto err_out1;
ddf19c
     }
ddf19c
 
ddf19c
     /*
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c