aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/os/log.c')
-rw-r--r--xorg-server/os/log.c48
1 files changed, 34 insertions, 14 deletions
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] != '%') {
@@ -320,6 +321,15 @@ pnprintf(char *string, size_t size, const char *f, va_list args)
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;
case 'p':
string[s_idx++] = '0';
@@ -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);