summaryrefslogtreecommitdiff
path: root/source3/client/smbmount.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/client/smbmount.c')
-rw-r--r--source3/client/smbmount.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index 364c28cdcd..2cfd166688 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -255,6 +255,7 @@ static void
send_fs_socket(char *mount_point, char *inbuf, char *outbuf)
{
int fd, closed = 0, res = 1;
+ int first_time = 1;
while (1)
{
@@ -290,6 +291,15 @@ send_fs_socket(char *mount_point, char *inbuf, char *outbuf)
}
#endif
+ if( first_time ) {
+ /*
+ * Create the background process after trying the mount.
+ * to avoid race conditions with automount and other processes.
+ */
+ first_time = 0;
+ daemonize();
+ }
+
/*
* Wait for a signal from smbfs ...
*/
@@ -364,15 +374,6 @@ static void cmd_mount(char *inbuf,char *outbuf)
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);
}