From 41c6e8cc55ed2ad0abf50b545ceb0587ce04804a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 12 Nov 2003 14:44:31 +0000 Subject: [PATCH] Fixed the setlogmask*() functions; the priority mask is only set if the parameter is not 0, and it returns the old mask as well. Also fixed the initial log mask for the team context; it's now set to -1 (enable all priorities) by default. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5329 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/syslog.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/kernel/libroot/posix/syslog.cpp b/src/kernel/libroot/posix/syslog.cpp index 3ccbcf44a3..7f092373b7 100644 --- a/src/kernel/libroot/posix/syslog.cpp +++ b/src/kernel/libroot/posix/syslog.cpp @@ -20,7 +20,11 @@ struct syslog_context { int32 options; }; -static syslog_context sTeamContext; +static syslog_context sTeamContext = { + "", + -1, + 0 +}; static int32 sThreadContextSlot = -1; @@ -128,7 +132,8 @@ send_syslog_message(syslog_context *context, int priority, const char *text, va_ // #pragma mark - -// public API +// public Be API +// ToDo: it would probably be better to export these symbols as weak symbols only void @@ -151,7 +156,12 @@ openlog_team(const char *ident, int options, int facility) int setlogmask_team(int priorityMask) { - sTeamContext.mask = priorityMask; + int oldMask = sTeamContext.mask; + + if (priorityMask != 0) + sTeamContext.mask = priorityMask; + + return oldMask; } @@ -193,7 +203,12 @@ int setlogmask_thread(int priorityMask) { syslog_context *context = get_context(); - context->mask = priorityMask; + int oldMask = context->mask; + + if (priorityMask != 0) + context->mask = priorityMask; + + return oldMask; } @@ -229,7 +244,7 @@ openlog(const char *ident, int options, int facility) int setlogmask(int priorityMask) { - setlogmask_thread(priorityMask); + return setlogmask_thread(priorityMask); }