Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions archivemount.c
Original file line number Diff line number Diff line change
Expand Up @@ -2833,7 +2833,7 @@ int
main(int argc, char **argv)
{
struct stat st;
int oldpwd;
int oldpwd = -1;
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);

/* parse cmdline args */
Expand Down Expand Up @@ -2877,6 +2877,8 @@ main(int argc, char **argv)
archiveWriteable = 1;
close(archiveFd);
}
/* save directory this was started from */
oldpwd = open(".", 0);
}
/* We want the temporary fuser version of the archive to be writable,*/
/* despite never actually writing the changes to disk.*/
Expand All @@ -2901,9 +2903,6 @@ main(int argc, char **argv)
//log("cache st_size = %ld",rawcache->st.st_size);
}

/* save directory this was started from */
oldpwd = open(".", 0);

/* Initialize the node tree lock */
pthread_mutex_init(&lock, NULL);

Expand Down Expand Up @@ -2982,17 +2981,15 @@ main(int argc, char **argv)
}
#endif

/* go back to saved dir */
{
/* save changes if modified */
if (archiveWriteable && !options.readonly && archiveModified && !options.nosave) {
/* go back to saved dir */
int fchdir_ret;
fchdir_ret = fchdir(oldpwd);
if (fchdir_ret != 0) {
log("fchdir() to old path failed\n");
}
}

/* save changes if modified */
if (archiveWriteable && !options.readonly && archiveModified && !options.nosave) {
if (save(archiveFile) != 0) {
log("Saving new archive failed\n");
}
Expand Down