From f08ace0740cf373330148b2ec1fb699996852230 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Wed, 22 Oct 2003 11:11:57 +0000 Subject: fix --- util/fusermount.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'util/fusermount.c') 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); -- cgit v1.2.3