Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
callfcgi: Fixed free() typo.
[ashd.git]
/
src
/
accesslog.c
diff --git
a/src/accesslog.c
b/src/accesslog.c
index
ac324d5
..
27663c4
100644
(file)
--- a/
src/accesslog.c
+++ b/
src/accesslog.c
@@
-41,7
+41,7
@@
static char *outname = NULL;
static FILE *out;
static int flush = 1;
static char *format;
static FILE *out;
static int flush = 1;
static char *format;
-static
time_t
now;
+static
struct timeval
now;
static volatile int reopen = 0;
static void qputs(char *s, FILE *o)
static volatile int reopen = 0;
static void qputs(char *s, FILE *o)
@@
-67,7
+67,6
@@
static void logitem(struct hthead *req, char o, char *d)
{
char *h, *p;
char buf[1024];
{
char *h, *p;
char buf[1024];
- struct timeval tv;
switch(o) {
case '%':
switch(o) {
case '%':
@@
-101,18
+100,17
@@
static void logitem(struct hthead *req, char o, char *d)
case 't':
if(!*d)
d = "%a, %d %b %Y %H:%M:%S %z";
case 't':
if(!*d)
d = "%a, %d %b %Y %H:%M:%S %z";
- strftime(buf, sizeof(buf), d, localtime(&now));
+ strftime(buf, sizeof(buf), d, localtime(&now
.tv_sec
));
qputs(buf, out);
break;
case 'T':
if(!*d)
d = "%a, %d %b %Y %H:%M:%S %z";
qputs(buf, out);
break;
case 'T':
if(!*d)
d = "%a, %d %b %Y %H:%M:%S %z";
- strftime(buf, sizeof(buf), d, gmtime(&now));
+ strftime(buf, sizeof(buf), d, gmtime(&now
.tv_sec
));
qputs(buf, out);
break;
case 's':
qputs(buf, out);
break;
case 's':
- gettimeofday(&tv, NULL);
- fprintf(out, "%06i", (int)tv.tv_usec);
+ fprintf(out, "%06i", (int)now.tv_usec);
break;
case 'A':
logitem(req, 'h', "X-Ash-Address");
break;
case 'A':
logitem(req, 'h', "X-Ash-Address");
@@
-164,7
+162,7
@@
static void logreq(struct hthead *req)
static void serve(struct hthead *req, int fd)
{
static void serve(struct hthead *req, int fd)
{
-
now = time(
NULL);
+
gettimeofday(&now,
NULL);
if(sendreq(ch, req, fd)) {
flog(LOG_ERR, "accesslog: could not pass request to child: %s", strerror(errno));
exit(1);
if(sendreq(ch, req, fd)) {
flog(LOG_ERR, "accesslog: could not pass request to child: %s", strerror(errno));
exit(1);
@@
-206,7
+204,6
@@
int main(int argc, char **argv)
int fd;
struct pollfd pfd[2];
int fd;
struct pollfd pfd[2];
- optarg = NULL;
while((c = getopt(argc, argv, "+hFaf:")) >= 0) {
switch(c) {
case 'h':
while((c = getopt(argc, argv, "+hFaf:")) >= 0) {
switch(c) {
case 'h':
@@
-245,7
+242,7
@@
int main(int argc, char **argv)
}
}
if((ch = stdmkchild(argv + optind + 1, NULL, NULL)) < 0) {
}
}
if((ch = stdmkchild(argv + optind + 1, NULL, NULL)) < 0) {
- flog(LOG_ERR, "accesslog: could fork child: %s", strerror(errno));
+ flog(LOG_ERR, "accesslog: could
not
fork child: %s", strerror(errno));
exit(1);
}
signal(SIGHUP, sighandler);
exit(1);
}
signal(SIGHUP, sighandler);