diff options
author | David Dykstra <dwd@samba.org> | 1999-02-03 15:38:06 +0000 |
---|---|---|
committer | David Dykstra <dwd@samba.org> | 1999-02-03 15:38:06 +0000 |
commit | c226b7c2fdd6cc4357337514b22c3042195ab091 (patch) | |
tree | aaa0111e953f51c38232616addfd0ca8e0ab3292 /util.c | |
parent | 5865fcdd6370cef7d3a4997500a9a28f3114ad7f (diff) | |
download | rsync-c226b7c2fdd6cc4357337514b22c3042195ab091.tar.gz |
Move the initialization of push_dir, which calls getcwd, to early in main.
The reason for that is that on SVR2-based UTS 2.1.2 (which along with many
other old systems implements getcwd by forking "pwd") getcwd hangs when
called when other child processes are running.
I also added a quick return from push_dir if name == NULL so it doesn't
actually have to chdir anywhere when just initializing.
An initializing call to push_dir("/",0) had previously been put in at the
beginning of daemon_main() to avoid calling getcwd after a chroot, but
since that is no longer I needed I removed it and changed the call to
chdir("/") after chroot into a push_dir("/",0) so it will remember the
correct current directory.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -638,6 +638,8 @@ char *push_dir(char *dir, int save) getcwd(curr_dir, sizeof(curr_dir)-1); } + if (!dir) return NULL; /* this call was probably just to initialize */ + if (chdir(dir)) return NULL; if (save) { |