From df210e9e10cf7cd036954a7e772552fdbf715f83 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Wed, 25 Apr 2018 18:40:51 +0200 Subject: lib: Unmount stale FUSE mountpoints This will unmount a stale FUSE mountpoint (an IPCP with the same pid exited ungracefully on the system) before trying to create it. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/rib.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/rib.c b/src/lib/rib.c index 909d217f..fa525c50 100644 --- a/src/lib/rib.c +++ b/src/lib/rib.c @@ -280,7 +280,16 @@ int rib_init(const char * prefix) sprintf(rib.mnt, FUSE_PREFIX "/%s.%d", prefix, getpid()); if (stat(rib.mnt, &st) == -1) - mkdir(rib.mnt, 0777); + switch(errno) { + case ENOENT: + mkdir(rib.mnt, 0777); + break; + case ENOTCONN: + fuse_unmount(rib.mnt, rib.ch); + break; + default: + return -1; + } fuse_opt_parse(&args, NULL, NULL, NULL); -- cgit v1.2.3