projects
/
platform
/
upstream
/
toybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d0bc1a3
)
I added error handling code in write_rotate().
author
Hyejin Kim
<hj8296@gmail.com>
Mon, 16 Mar 2015 00:29:15 +0000
(19:29 -0500)
committer
Hyejin Kim
<hj8296@gmail.com>
Mon, 16 Mar 2015 00:29:15 +0000
(19:29 -0500)
I think that it is better to check tf->logfd before doing
truncate()/write() and getting error.
toys/pending/syslogd.c
patch
|
blob
|
history
diff --git
a/toys/pending/syslogd.c
b/toys/pending/syslogd.c
index
7fb297f
..
450bd72
100644
(file)
--- 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);
}