projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make powerpc signal.h namespace-clean for posix/isoc
[musl]
/
src
/
misc
/
syslog.c
diff --git
a/src/misc/syslog.c
b/src/misc/syslog.c
index
cbe6520
..
8de34f8
100644
(file)
--- a/
src/misc/syslog.c
+++ b/
src/misc/syslog.c
@@
-10,7
+10,7
@@
#include <pthread.h>
#include "libc.h"
#include <pthread.h>
#include "libc.h"
-static int lock;
+static int lock
[2]
;
static const char *log_ident;
static int log_opt;
static int log_facility = LOG_USER;
static const char *log_ident;
static int log_opt;
static int log_facility = LOG_USER;
@@
-36,10
+36,10
@@
void closelog(void)
{
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
{
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- LOCK(
&
lock);
+ LOCK(lock);
close(log_fd);
log_fd = -1;
close(log_fd);
log_fd = -1;
- UNLOCK(
&
lock);
+ UNLOCK(lock);
pthread_setcancelstate(cs, 0);
}
pthread_setcancelstate(cs, 0);
}
@@
-51,17
+51,16
@@
static void __openlog(const char *ident, int opt, int facility)
if (!(opt & LOG_NDELAY) || log_fd>=0) return;
if (!(opt & LOG_NDELAY) || log_fd>=0) return;
- log_fd = socket(AF_UNIX, SOCK_DGRAM, 0);
- fcntl(log_fd, F_SETFD, FD_CLOEXEC);
+ log_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
}
void openlog(const char *ident, int opt, int facility)
{
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
}
void openlog(const char *ident, int opt, int facility)
{
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- LOCK(
&
lock);
+ LOCK(lock);
__openlog(ident, opt, facility);
__openlog(ident, opt, facility);
- UNLOCK(
&
lock);
+ UNLOCK(lock);
pthread_setcancelstate(cs, 0);
}
pthread_setcancelstate(cs, 0);
}
@@
-77,7
+76,7
@@
static void _vsyslog(int priority, const char *message, va_list ap)
if (log_fd < 0) {
__openlog(log_ident, log_opt | LOG_NDELAY, log_facility);
if (log_fd < 0) {
if (log_fd < 0) {
__openlog(log_ident, log_opt | LOG_NDELAY, log_facility);
if (log_fd < 0) {
- UNLOCK(
&
lock);
+ UNLOCK(lock);
return;
}
}
return;
}
}
@@
-98,7
+97,7
@@
static void _vsyslog(int priority, const char *message, va_list ap)
sendto(log_fd, buf, l, 0, (void *)&log_addr, 11);
}
sendto(log_fd, buf, l, 0, (void *)&log_addr, 11);
}
- UNLOCK(
&
lock);
+ UNLOCK(lock);
}
void __vsyslog(int priority, const char *message, va_list ap)
}
void __vsyslog(int priority, const char *message, va_list ap)
@@
-106,9
+105,9
@@
void __vsyslog(int priority, const char *message, va_list ap)
int cs;
if (!(log_mask & LOG_MASK(priority&7)) || (priority&~0x3ff)) return;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
int cs;
if (!(log_mask & LOG_MASK(priority&7)) || (priority&~0x3ff)) return;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
- LOCK(
&
lock);
+ LOCK(lock);
_vsyslog(priority, message, ap);
_vsyslog(priority, message, ap);
- UNLOCK(
&
lock);
+ UNLOCK(lock);
pthread_setcancelstate(cs, 0);
}
pthread_setcancelstate(cs, 0);
}