register_command_task(cookie, &s);
s.default_timeout.tv_sec = 0;
s.default_timeout.tv_usec = 999 * 1000;
+ ret = write(socket_fd, "\0", 1);
+ if (ret != 1) {
+ if (ret == 0)
+ errno = EINVAL;
+ ret = -ERRNO_TO_PARA_ERROR(errno);
+ goto out_close;
+ }
ret = schedule(&s);
sched_shutdown(&s);
out_close:
{
int ret, afs_server_socket[2];
pid_t afs_pid;
+ char c;
- ret = socketpair(PF_UNIX, SOCK_DGRAM, 0, afs_server_socket);
+ ret = socketpair(PF_UNIX, SOCK_STREAM, 0, afs_server_socket);
if (ret < 0)
exit(EXIT_FAILURE);
get_random_bytes_or_die((unsigned char *)&afs_socket_cookie,
exit(EXIT_FAILURE);
if (afs_pid == 0) { /* child (afs) */
int i;
+
for (i = argc - 1; i >= 0; i--)
memset(argv[i], 0, strlen(argv[i]));
sprintf(argv[0], "para_server (afs)");
}
mmd->afs_pid = afs_pid;
close(afs_server_socket[1]);
+ if (read(afs_server_socket[0], &c, 1) <= 0) {
+ PARA_EMERG_LOG("early afs exit\n");
+ exit(EXIT_FAILURE);
+ }
ret = mark_fd_nonblocking(afs_server_socket[0]);
if (ret < 0)
exit(EXIT_FAILURE);