Module: xenomai-3
Branch: master
Commit: 9b8fa963ae6c4751602c00f6be81861b620822af
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=9b8fa963ae6c4751602c00f6be81861b620822af

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Mar 17 16:00:22 2015 +0100

copperplate/regd: fall back to umount if fusermount -u failed

---

 lib/copperplate/regd/regd.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/lib/copperplate/regd/regd.c b/lib/copperplate/regd/regd.c
index fd5b060..a767592 100644
--- a/lib/copperplate/regd/regd.c
+++ b/lib/copperplate/regd/regd.c
@@ -269,11 +269,22 @@ static void unmount(const char *path)
        if (flags >= 0)
                fcntl(2, F_SETFD, flags | FD_CLOEXEC);
 
-       if (asprintf(&cmd, "/usr/bin/fusermount -uzq %s", path) > 0) {
-               ret = system(cmd);
-               (void)ret;
-               free(cmd);
-       }
+       ret = asprintf(&cmd, "/usr/bin/fusermount -uzq %s", path);
+       if (ret < 0)
+               return;
+
+       ret = system(cmd);
+       free(cmd);
+       if (ret != -1 && WIFEXITED(ret) && WEXITSTATUS(ret) == 0)
+               return;
+
+       ret = asprintf(&cmd, "/usr/bin/umount -l %s", path);
+       if (ret < 0)
+               return;
+
+       ret = system(cmd);
+       free(cmd);
+       (void)ret;
 }
 
 static void unregister_client(int s)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to