diff options
Diffstat (limited to 'util/fusermount.c')
-rw-r--r-- | util/fusermount.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/util/fusermount.c b/util/fusermount.c index 0f94c7e..f223c5f 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -150,16 +150,8 @@ static int remove_mount(const char *mnt) remove = 1; } } - if(remove) { - res = umount2(mnt, 2); /* Lazy umount */ - if(res == -1) { - fprintf(stderr, "%s: failed to unmount %s: %s\n", progname, - mnt, strerror(errno)); - found = -1; - break; - } + if(remove) found = 1; - } else { res = addmntent(newfp, entp); if(res != 0) { @@ -172,6 +164,15 @@ static int remove_mount(const char *mnt) endmntent(fp); endmntent(newfp); + + if(found) { + res = umount2(mnt, 2); /* Lazy umount */ + if(res == -1) { + fprintf(stderr, "%s: failed to unmount %s: %s\n", progname, mnt, + strerror(errno)); + found = -1; + } + } if(found == 1) { res = rename(mtab_new, mtab); |