aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2010-11-08 17:53:47 +0100
committerGravatar Miklos Szeredi <mszeredi@suse.cz>2010-11-08 17:53:47 +0100
commit2fcbc2a5a94983813c533c015134c6974f8ee636 (patch)
tree0b100617d033b8febcf46a4a76908b09499c597e /util
parentb8ce6e5026b72851324c633c66d682968d3b3f26 (diff)
fusermount: don't save/restore cwd
Remove unnecessary restoring of current working directory in "fusermount -u"
Diffstat (limited to 'util')
-rw-r--r--util/fusermount.c17
1 files changed, 2 insertions, 15 deletions
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;
}