OSDN Git Service

Fix bug 575 and other small problems noticed along the way.
authorDenis Vlasenko <vda.linux@googlemail.com>
Tue, 3 Jun 2008 14:26:12 +0000 (14:26 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Tue, 3 Jun 2008 14:26:12 +0000 (14:26 -0000)
commit4139fe5aec935ba3f462dcaf6aafb6e5eadf1ab9
treecd0bc77821630182791969de1dfe24f5c19247f7
parentc28c512dce1579fdac187f78e8282635a18d0a93
Fix bug 575 and other small problems noticed along the way.
The bug: this blocks in syslogd is stopped:
#include <syslog.h>
int main() {
        int i;
        for (i = 0; i < 10000; i++)
                syslog(LOG_INFO, "Testing, disregard....................");
        return 0;
}
Fix: set O_NONBLOCK on fd to "/dev/log".
Other fixes: do not try to write to fd -1, do not spin forever or EAGAIN,
use constant sockaddr instead of recreating identical one each time,
eliminate one intermediate function (SUGPIPE sig handler),
use smallints where appropriate, add a few comments.

Size:
    text           data     bss     dec     hex filename
-   1140             16      21    1177     499 libc/misc/syslog/syslog.o
+   1123             13       2    1138     472 libc/misc/syslog/syslog.o
libc/misc/syslog/syslog.c