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