]> git.saurik.com Git - apple/network_cmds.git/blobdiff - nfsd.tproj/nfsd.c
network_cmds-245.17.tar.gz
[apple/network_cmds.git] / nfsd.tproj / nfsd.c
index a40ac6ad586701157d314a9018b83f79853598d9..3a97b6446baa3ab0c654b06c085ccf90ad62a216 100644 (file)
@@ -374,8 +374,14 @@ main(argc, argv, envp)
                inetaddr.sin_len = sizeof(inetaddr);
                if (bind(sock,
                    (struct sockaddr *)&inetaddr, sizeof(inetaddr)) < 0) {
-                       syslog(LOG_ERR, "can't bind udp addr");
-                       exit(1);
+                       /* socket may still be lingering from previous incarnation */
+                       /* wait a few seconds and try again */
+                       sleep(6);
+                       if (bind(sock,
+                           (struct sockaddr *)&inetaddr, sizeof(inetaddr)) < 0) {
+                               syslog(LOG_ERR, "can't bind udp addr");
+                               exit(1);
+                       }
                }
                if (!pmap_set(RPCPROG_NFS, 2, IPPROTO_UDP, NFS_PORT) ||
                    !pmap_set(RPCPROG_NFS, 3, IPPROTO_UDP, NFS_PORT)) {