Fix off-by-one in daemon detach
This commit is contained in:
@@ -159,7 +159,7 @@ roken_detach_prep(int argc, char **argv, char *special_arg)
|
|||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||||
roken_detach_finish(const char *dir, int daemon_child_fd)
|
roken_detach_finish(const char *dir, int daemon_child_fd)
|
||||||
{
|
{
|
||||||
char buf[1];
|
char buf[1] = "";
|
||||||
ssize_t bytes;
|
ssize_t bytes;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@@ -187,7 +187,6 @@ roken_detach_finish(const char *dir, int daemon_child_fd)
|
|||||||
err(1, "failed to chdir to /");
|
err(1, "failed to chdir to /");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf[1] = 0;
|
|
||||||
do {
|
do {
|
||||||
bytes = write(pipefds[1], buf, sizeof(buf));
|
bytes = write(pipefds[1], buf, sizeof(buf));
|
||||||
} while (bytes == -1 && errno == EINTR);
|
} while (bytes == -1 && errno == EINTR);
|
||||||
|
Reference in New Issue
Block a user