Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1b7621b
)
accesslog: Fixed up stdout logging and related FD_CLOEXEC usage.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 13 May 2011 23:39:11 +0000
(
01:39
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 13 May 2011 23:39:11 +0000
(
01:39
+0200)
src/accesslog.c
patch
|
blob
|
blame
|
history
diff --git
a/src/accesslog.c
b/src/accesslog.c
index
02e5f1a
..
3a978e0
100644
(file)
--- a/
src/accesslog.c
+++ b/
src/accesslog.c
@@
-255,6
+255,7
@@
static void reopenlog(void)
flog(LOG_WARNING, "accesslog: could not reopen log file `%s' on SIGHUP: %s", outname, strerror(errno));
return;
}
flog(LOG_WARNING, "accesslog: could not reopen log file `%s' on SIGHUP: %s", outname, strerror(errno));
return;
}
+ fcntl(fileno(new), F_SETFD, FD_CLOEXEC);
if(locklog) {
if(lockfile(new)) {
if((errno == EAGAIN) || (errno == EACCES)) {
if(locklog) {
if(lockfile(new)) {
if((errno == EAGAIN) || (errno == EACCES)) {
@@
-326,11
+327,13
@@
int main(int argc, char **argv)
outname = argv[optind];
if(outname == NULL) {
out = stdout;
outname = argv[optind];
if(outname == NULL) {
out = stdout;
+ locklog = 0;
} else {
if((out = fopen(argv[optind], "a")) == NULL) {
flog(LOG_ERR, "accesslog: could not open %s for logging: %s", argv[optind], strerror(errno));
exit(1);
}
} else {
if((out = fopen(argv[optind], "a")) == NULL) {
flog(LOG_ERR, "accesslog: could not open %s for logging: %s", argv[optind], strerror(errno));
exit(1);
}
+ fcntl(fileno(out), F_SETFD, FD_CLOEXEC);
}
if(locklog) {
if(lockfile(out)) {
}
if(locklog) {
if(lockfile(out)) {
@@
-342,7
+345,6
@@
int main(int argc, char **argv)
}
}
}
}
}
}
- fcntl(fileno(out), F_SETFD, FD_CLOEXEC);
if((ch = stdmkchild(argv + optind + 1, NULL, NULL)) < 0) {
flog(LOG_ERR, "accesslog: could not fork child: %s", strerror(errno));
exit(1);
if((ch = stdmkchild(argv + optind + 1, NULL, NULL)) < 0) {
flog(LOG_ERR, "accesslog: could not fork child: %s", strerror(errno));
exit(1);