From 2fcbc2a5a94983813c533c015134c6974f8ee636 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 8 Nov 2010 17:53:47 +0100 Subject: fusermount: don't save/restore cwd Remove unnecessary restoring of current working directory in "fusermount -u" --- util/fusermount.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'util/fusermount.c') diff --git a/util/fusermount.c b/util/fusermount.c index 3b4125e..588d1bf 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -335,7 +335,7 @@ static int check_is_mount(const char *last, const char *mnt) return 0; } -static int chdir_to_parent(char *copy, const char **lastp, int *currdir_fd) +static int chdir_to_parent(char *copy, const char **lastp) { char *tmp; const char *parent; @@ -360,14 +360,6 @@ static int chdir_to_parent(char *copy, const char **lastp, int *currdir_fd) parent = "/"; } - *currdir_fd = open(".", O_RDONLY); - if (*currdir_fd == -1) { - fprintf(stderr, - "%s: failed to open current directory: %s\n", - progname, strerror(errno)); - return -1; - } - res = chdir(parent); if (res == -1) { fprintf(stderr, "%s: failed to chdir to %s: %s\n", @@ -392,7 +384,6 @@ static int chdir_to_parent(char *copy, const char **lastp, int *currdir_fd) static int unmount_fuse_legacy(const char *mnt, int lazy) { - int currdir_fd = -1; char *copy; const char *last; int res; @@ -403,7 +394,7 @@ static int unmount_fuse_legacy(const char *mnt, int lazy) return -1; } - res = chdir_to_parent(copy, &last, &currdir_fd); + res = chdir_to_parent(copy, &last); if (res == -1) goto out; @@ -415,10 +406,6 @@ static int unmount_fuse_legacy(const char *mnt, int lazy) out: free(copy); - if (currdir_fd != -1) { - fchdir(currdir_fd); - close(currdir_fd); - } return res; } -- cgit v1.2.3