fd = open(path, O_RDWR);
if (fd == -1)
return -1;
- write(fd, stime, strlen(stime));
+ if (write(fd, stime, strlen(stime)) != strlen(stime)) {
+ errx(1, "Flushing nfsd cache failed: errno %d (%s)",
+ errno, strerror(errno));
+ }
close(fd);
return 0;
}
xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
if (fcntl(fd, F_NOTIFY,
- DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1)
+ DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1) {
xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
-
+ if (errno == EINVAL)
+ xlog_err("main: Possibly no Dnotify support in kernel.");
+ }
TAILQ_INIT(&icq);
/* These events are persistent */
return (-1);
}
- if (string[i] != '\0')
+ if ((i >= len) || string[i] != '\0')
return (-1);
return (i + 1);
dup2(tempfd, 0);
dup2(tempfd, 1);
dup2(tempfd, 2);
- closeall(3);
- } else
- closeall(0);
+ close(tempfd);
+ } else {
+ err(1, "mydaemon: can't open /dev/null: errno %d",
+ errno);
+ exit(1);
+ }
}
return;
int status;
if (pipefds[1] > 0) {
- write(pipefds[1], &status, 1);
+ if (write(pipefds[1], &status, 1) != 1) {
+ err(1, "Writing to parent pipe failed: errno %d (%s)\n",
+ errno, strerror(errno));
+ }
close(pipefds[1]);
pipefds[1] = -1;
}