summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-04-25 18:40:51 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-04-26 09:56:02 +0200
commitdf210e9e10cf7cd036954a7e772552fdbf715f83 (patch)
tree37fa958f368d3da39a39ee06f753bf23fd3e61de
parent413064a95645ab569c2adae4e422cc6aefdf8304 (diff)
downloadouroboros-df210e9e10cf7cd036954a7e772552fdbf715f83.tar.gz
ouroboros-df210e9e10cf7cd036954a7e772552fdbf715f83.zip
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 <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
-rw-r--r--src/lib/rib.c11
1 files changed, 10 insertions, 1 deletions
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);