summaryrefslogtreecommitdiff
path: root/source3/client/smbmount.c
diff options
context:
space:
mode:
authorMichael Warfield <mhw@samba.org>1998-11-13 20:32:22 +0000
committerMichael Warfield <mhw@samba.org>1998-11-13 20:32:22 +0000
commit9c3cbb8012423f49793a7caf182bbf144ba311cd (patch)
tree0d39449b1868ce7986b71dafefbe102e2a73048b /source3/client/smbmount.c
parent3a31d509a883e321784154ed6c4e0b6bc21673c4 (diff)
downloadsamba-9c3cbb8012423f49793a7caf182bbf144ba311cd.tar.gz
samba-9c3cbb8012423f49793a7caf182bbf144ba311cd.tar.bz2
samba-9c3cbb8012423f49793a7caf182bbf144ba311cd.zip
Fixed timing window created by daemonize function. Smbmount was going daemon
before the mount was actually completed. This caused weird problems when used with autofs such as empty directories on first listing or files which would appear in "ls" but would return "no such file or directory" under "ls -l". Note to Volker: Initial attempt from CIFS conference didn't work. Had to move daemonize function inside of loop after ioctl. (This used to be commit 2f456be660b4bbf22c618b506062f812f35e368a)
Diffstat (limited to 'source3/client/smbmount.c')
-rw-r--r--source3/client/smbmount.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index 4dd54db954..364c28cdcd 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -358,18 +358,21 @@ static void cmd_mount(char *inbuf,char *outbuf)
DEBUG(3, ("mount command: %s\n", mount_command));
- /*
- * Create the background process before trying the mount.
- * (We delay closing files to allow diagnostic messages.)
- */
- daemonize();
-
- /* The parent has exited here, the child handles the connection: */
if ((retval = system(mount_command)) != 0)
{
DEBUG(0,("mount failed\n"));
exit(1);
}
+
+ /*
+ * Create the background process after trying the mount.
+ * to avoid race conditions with automount and other processes.
+ */
+ daemonize();
+
+ /* The parent has exited here, leave the daemon to deal with
+ * disconnects and reconnects
+ */
send_fs_socket(mount_point, inbuf, outbuf);
}