From: Philip Homburg Date: Thu, 10 Aug 2006 14:11:25 +0000 (+0000) Subject: Use syslog for logging. X-Git-Tag: v3.1.3~209 X-Git-Url: http://zhaoyanbai.com/repos/pkcs11-keygen.html?a=commitdiff_plain;h=6076eddf9c73f076ec891158a82c241bf80a5f2f;p=minix.git Use syslog for logging. --- diff --git a/lib/ip/servxcheck.c b/lib/ip/servxcheck.c index a6229628a..db5d4e9f7 100755 --- a/lib/ip/servxcheck.c +++ b/lib/ip/servxcheck.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -214,7 +215,7 @@ int servxcheck(ipaddr_t peer, const char *service, if (c != '-' && c != '+') { if (logf == nil) { - fprintf(stderr, "%s: strange check word '%s'\n", + syslog(LOG_ERR, "%s: strange check word '%s'\n", path_servacces, word); } continue; @@ -264,28 +265,8 @@ int servxcheck(ipaddr_t peer, const char *service, if (logf != nil) { (*logf)(state == PASS, name); } else { - int lfd; - char line[128+WLEN]; - time_t t; - struct tm *tm; - char month[][4]= { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", - }; - - if ((lfd= open("/usr/adm/log", O_WRONLY|O_APPEND)) != -1) { - time(&t); - tm= localtime(&t); - sprintf(line, "%s %02d %02d:%02d:%02d service '%s' %s to %s\n", - month[tm->tm_mon], - tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec, - service, - state == PASS ? "granted" : "denied", - name); - (void) write(lfd, line, strlen(line)); - close(lfd); - } + syslog(LOG_NOTICE, "service '%s' %s to %s\n", + service, state == PASS ? "granted" : "denied", name); } } return state == PASS;