projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
daemon reopen flag change ownership of logfile to -u uid YAZ-819
[yaz-moved-to-github.git]
/
src
/
daemon.c
diff --git
a/src/daemon.c
b/src/daemon.c
index
4448e1d
..
27e97db
100644
(file)
--- a/
src/daemon.c
+++ b/
src/daemon.c
@@
-261,6
+261,15
@@
int yaz_daemon(const char *progname,
yaz_log(YLOG_FATAL, "%s: Unknown user", uid);
exit(1);
}
yaz_log(YLOG_FATAL, "%s: Unknown user", uid);
exit(1);
}
+ if (flags & YAZ_DAEMON_LOG_REOPEN)
+ {
+ FILE *f = yaz_log_file();
+ if (f)
+ {
+ if (fchown(fileno(f), pw->pw_uid, -1))
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "fchown logfile");
+ }
+ }
if (setuid(pw->pw_uid) < 0)
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "setuid");
if (setuid(pw->pw_uid) < 0)
{
yaz_log(YLOG_FATAL|YLOG_ERRNO, "setuid");