summaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-03-04 09:44:43 -0500
committerRich Felker <dalias@aerifal.cx>2015-03-04 09:44:43 -0500
commit6de071a0be00ec2ff08af3c89c7caaa20f1044d7 (patch)
treedf844369359ade34b436d44f07be0652bc701a1d /src/misc
parent7a81fe3710be0128d29071e76c5acbea3d84277b (diff)
downloadmusl-6de071a0be00ec2ff08af3c89c7caaa20f1044d7.tar.gz
musl-6de071a0be00ec2ff08af3c89c7caaa20f1044d7.tar.bz2
musl-6de071a0be00ec2ff08af3c89c7caaa20f1044d7.tar.xz
musl-6de071a0be00ec2ff08af3c89c7caaa20f1044d7.zip
eliminate atomics in syslog setlogmask function
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/syslog.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/misc/syslog.c b/src/misc/syslog.c
index b934a686..e026f9b4 100644
--- a/src/misc/syslog.c
+++ b/src/misc/syslog.c
@@ -10,19 +10,21 @@
#include <errno.h>
#include <fcntl.h>
#include "libc.h"
-#include "atomic.h"
static volatile int lock[2];
static char log_ident[32];
static int log_opt;
static int log_facility = LOG_USER;
-static volatile int log_mask = 0xff;
+static int log_mask = 0xff;
static int log_fd = -1;
int setlogmask(int maskpri)
{
- if (maskpri) return a_swap(&log_mask, maskpri);
- else return log_mask;
+ LOCK(lock);
+ int ret = log_mask;
+ if (maskpri) log_mask = maskpri;
+ UNLOCK(lock);
+ return ret;
}
static const struct {