[Libguestfs] [PATCH] fuse: fix return value of guestunmount for unmounted paths

Pino Toscano ptoscano at redhat.com
Mon Nov 23 16:58:44 UTC 2015


Exit with 3 as return value when fusermount fails, because the specified
mount point is not considered mounted for the user.  This is in line
with what the guestunmount documentation says.

Adapt the test-guestunmount-fd test to the updated return value.

Thanks to: Maxim Perevedentsev.
---
 fuse/guestunmount.c         | 2 +-
 fuse/test-guestunmount-fd.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fuse/guestunmount.c b/fuse/guestunmount.c
index e952c63..fa6d5bb 100644
--- a/fuse/guestunmount.c
+++ b/fuse/guestunmount.c
@@ -220,7 +220,7 @@ main (int argc, char *argv[])
 
   free (error);
 
-  exit (2);
+  exit (3);
 
   /* success */
  done:
diff --git a/fuse/test-guestunmount-fd.c b/fuse/test-guestunmount-fd.c
index 93adc98..b09a60f 100644
--- a/fuse/test-guestunmount-fd.c
+++ b/fuse/test-guestunmount-fd.c
@@ -107,8 +107,8 @@ main (int argc, char *argv[])
   }
 
   /* Close the write side of the pipe.  This should cause guestunmount
-   * to exit.  It should exit with status code _2_ because we gave it
-   * a mountpoint which isn't a FUSE mountpoint.
+   * to exit.  It should exit with status code _3_ because we gave it
+   * a directory which isn't a FUSE mountpoint.
    */
   close (pipefd[1]);
 
@@ -117,10 +117,10 @@ main (int argc, char *argv[])
     perror ("waitpid");
     exit (EXIT_FAILURE);
   }
-  if (!WIFEXITED (status) || WEXITSTATUS (status) != 2) {
+  if (!WIFEXITED (status) || WEXITSTATUS (status) != 3) {
     char status_string[80];
 
-    fprintf (stderr, "%s: test failed: guestunmount didn't return status code 2; %s\n",
+    fprintf (stderr, "%s: test failed: guestunmount didn't return status code 3; %s\n",
              guestfs_int_program_name,
              guestfs_int_exit_status_to_string (status, "guestunmount",
 						status_string,
-- 
2.1.0




More information about the Libguestfs mailing list