aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/pending/syslogd.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/pending/syslogd.c b/toys/pending/syslogd.c
index 7fb297f8..450bd72f 100644
--- a/toys/pending/syslogd.c
+++ b/toys/pending/syslogd.c
@@ -300,6 +300,10 @@ static int write_rotate(struct logfile *tf, int len)
unlink(tf->filename);
close(tf->logfd);
tf->logfd = open(tf->filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
+ if (tf->logfd < 0) {
+ perror_msg("can't open %s", tf->filename);
+ return -1;
+ }
}
ftruncate(tf->logfd, 0);
}