if (initialised != sys_getpid()) {
if (pipe(select_pipe) == -1)
- smb_panic("Could not create select pipe");
+ {
+ DEBUG(0, ("sys_select: pipe failed (%s)\n",
+ strerror(errno)));
+ if (readfds != NULL)
+ FD_ZERO(readfds);
+ if (writefds != NULL)
+ FD_ZERO(writefds);
+ if (errorfds != NULL)
+ FD_ZERO(errorfds);
+ return -1;
+ }
/*
* These next two lines seem to fix a bug with the Linux
ret = sys_select(maxfd, &r_fds, &w_fds, NULL, &to);
- /* If pause_pipe[1] is closed it means the parent smbd
- * and children exited or aborted. */
- if (ret == 1 && FD_ISSET(pause_pipe[1], &r_fds)) {
+ /*
+ * If pause_pipe[1] is closed it means the parent smbd
+ * and children exited or aborted. If sys_select()
+ * failed, then something more sinister is wrong
+ */
+ if ((ret < 0) ||
+ (ret == 1 && FD_ISSET(pause_pipe[1], &r_fds))) {
exit_server_cleanly(NULL);
}
continue;
}
+ /* socket error */
+ if (num < 0)
+ exit_server_cleanly("socket error");
+
/* If the idle timeout fired and we don't have any connected
* users, exit gracefully. We should be running under a process
* controller that will restart us if necessry.