#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
#include <signal.h>
+#include <sys/types.h>
+#include <sys/socket.h>
/* POSIX.1 sys/wait.h check */
#include <sys/types.h>
afp_child_t *child;
if (socketpair(PF_UNIX, SOCK_STREAM, 0, ipc_fds) < 0) {
- LOG(log_error, logtype_afpd, "dsi_getsess: %s", strerror(errno));
+ LOG(log_error, logtype_dsi, "dsi_getsess: %s", strerror(errno));
exit( EXITERR_CLNT );
}
if (setnonblock(ipc_fds[0], 1) != 0 || setnonblock(ipc_fds[1], 1) != 0) {
- LOG(log_error, logtype_afpd, "dsi_getsess: setnonblock: %s", strerror(errno));
+ LOG(log_error, logtype_dsi, "dsi_getsess: setnonblock: %s", strerror(errno));
exit(EXITERR_CLNT);
}
default: /* parent */
/* using SIGQUIT is hokey, but the child might not have
* re-established its signal handler for SIGTERM yet. */
- if ((child = server_child_add(serv_children, CHILD_DSIFORK, pid, ipc_fds)) < 0) {
+ if ((child = server_child_add(serv_children, CHILD_DSIFORK, pid, ipc_fds[0])) == NULL) {
LOG(log_error, logtype_dsi, "dsi_getsess: %s", strerror(errno));
dsi->header.dsi_flags = DSIFL_REPLY;
dsi->header.dsi_code = DSIERR_SERVBUSY;
dsi->header.dsi_code = DSIERR_OK;
kill(pid, SIGQUIT);
}
+ close(ipc_fds[1]);
dsi->proto_close(dsi);
return child;
}