From 9dec848b23cf905ded387820f2893425cc00d545 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 28 Aug 2012 14:07:02 +0200 Subject: fontconfig mesa xserver git update 28 Aug 2012 --- xorg-server/os/log.c | 48 ++++++++++++++++++++++++++++++++++-------------- xorg-server/os/utils.c | 14 ++++++++++++++ 2 files changed, 48 insertions(+), 14 deletions(-) (limited to 'xorg-server/os') diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index de7aaade7..9c83175c5 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -296,6 +296,7 @@ pnprintf(char *string, size_t size, const char *f, va_list args) int p_len; int i; uint64_t ui; + int64_t si; for (; f_idx < f_len && s_idx < size - 1; f_idx++) { if (f[f_idx] != '%') { @@ -317,6 +318,15 @@ pnprintf(char *string, size_t size, const char *f, va_list args) FormatUInt64(ui, number); p_len = strlen_sigsafe(number); + for (i = 0; i < p_len && s_idx < size - 1; i++) + string[s_idx++] = number[i]; + break; + case 'i': + case 'd': + si = va_arg(args, int); + FormatInt64(si, number); + p_len = strlen_sigsafe(number); + for (i = 0; i < p_len && s_idx < size - 1; i++) string[s_idx++] = number[i]; break; @@ -463,6 +473,7 @@ LogMessageTypeVerbString(MessageType type, int verb) void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { + static unsigned int warned; const char *type_str; char buf[1024]; const size_t size = sizeof(buf); @@ -470,13 +481,17 @@ LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) size_t len = 0; if (inSignalContext) { - BUG_WARN_MSG(inSignalContext, - "Warning: attempting to log data in a signal unsafe " - "manner while in signal context. Please update to check " - "inSignalContext and/or use LogMessageVerbSigSafe() or " - "ErrorFSigSafe(). The offending log format message is:\n" - "%s\n", format); - return; + if (warned < 3) { + BUG_WARN_MSG(inSignalContext, + "Warning: attempting to log data in a signal unsafe " + "manner while in signal context.\nPlease update to check " + "inSignalContext and/or use LogMessageVerbSigSafe() or " + "ErrorFSigSafe().\nThe offending log format message is:\n" + "%s\n", format); + warned++; + if (warned == 3) + LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned); + } } type_str = LogMessageTypeVerbString(type, verb); @@ -562,6 +577,7 @@ void LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, va_list msg_args, const char *hdr_format, va_list hdr_args) { + static unsigned int warned; const char *type_str; char buf[1024]; const size_t size = sizeof(buf); @@ -569,13 +585,17 @@ LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, size_t len = 0; if (inSignalContext) { - BUG_WARN_MSG(inSignalContext, - "Warning: attempting to log data in a signal unsafe " - "manner while in signal context. Please update to check " - "inSignalContext and/or use LogMessageVerbSigSafe(). The " - "offending header and log message formats are:\n%s %s\n", - hdr_format, msg_format); - return; + if (warned < 3) { + BUG_WARN_MSG(inSignalContext, + "Warning: attempting to log data in a signal unsafe " + "manner while in signal context.\nPlease update to check " + "inSignalContext and/or use LogMessageVerbSigSafe().\nThe " + "offending header and log message formats are:\n%s %s\n", + hdr_format, msg_format); + warned++; + if (warned == 3) + LogMessageVerbSigSafe(X_WARNING, -1, "Warned %u times about sigsafe logging. Will be quiet now.\n", warned); + } } type_str = LogMessageTypeVerbString(type, verb); diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 3e3d97011..43842c067 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -1987,6 +1987,20 @@ xstrtokenize(const char *str, const char *separators) return NULL; } +/* Format a signed number into a string in a signal safe manner. The string + * should be at least 21 characters in order to handle all int64_t values. + */ +void +FormatInt64(int64_t num, char *string) +{ + if (num < 0) { + string[0] = '-'; + num *= -1; + string++; + } + FormatUInt64(num, string); +} + /* Format a number into a string in a signal safe manner. The string should be * at least 21 characters in order to handle all uint64_t values. */ void -- cgit v1.2.3