summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2013-07-09 14:33:14 +0200
committerJohn Crispin <blogic@openwrt.org>2013-07-09 14:50:45 +0200
commit84c114b0756eaff7caf2693c61bdc307a080558c (patch)
treea0f0e43d6a3bd9ae71147c93c69d96aabec22df6
parent8e1c60874f0ec195340b52953311e1521c3a063e (diff)
downloadunitd-84c114b0756eaff7caf2693c61bdc307a080558c.tar
unitd-84c114b0756eaff7caf2693c61bdc307a080558c.zip
Fix logread file logging
This patch fixes logread and now appends to files instead of writting to the beginning the specified logfile. It also sets the access rights to 0600. Signed-off-by: Peter Wagner <tripolar@gmx.at>
-rw-r--r--logread.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/logread.c b/logread.c
index ba12f44..16af3ef 100644
--- a/logread.c
+++ b/logread.c
@@ -116,7 +116,7 @@ static int log_notify(struct ubus_context *ctx, struct ubus_object *obj,
rename(log_file, old);
free(old);
}
- sender.fd = open(log_file, O_CREAT | O_WRONLY | O_TRUNC);
+ sender.fd = open(log_file, O_CREAT | O_WRONLY | O_APPEND, 0600);
if (sender.fd < 0) {
// fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno));
exit(-1);
@@ -184,7 +184,7 @@ static void follow_log(struct ubus_context *ctx, int id)
uloop_timeout_set(&retry, 1000);
} else if (log_file) {
log_type = LOG_FILE;
- sender.fd = open(log_file, O_CREAT | O_WRONLY);
+ sender.fd = open(log_file, O_CREAT | O_WRONLY| O_APPEND, 0600);
if (sender.fd < 0) {
fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno));
exit(-1);