aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-28 14:07:02 +0200
committermarha <marha@users.sourceforge.net>2012-08-28 14:07:02 +0200
commit05d67ae9117e5157fd1a5175dde6d7e48caf4653 (patch)
tree601c92c99a901b165664df7482c7baf538d4d7c5 /xorg-server/os
parentb3462c12542a69eeaa3fe90fddfbb15d30c18158 (diff)
downloadvcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.gz
vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.tar.bz2
vcxsrv-05d67ae9117e5157fd1a5175dde6d7e48caf4653.zip
fontconfig mesa xserver git update 28 Aug 2012
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/log.c50
-rw-r--r--xorg-server/os/utils.c14
2 files changed, 49 insertions, 15 deletions
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 25da9f63a..4820e9a77 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -290,6 +290,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] != '%') {
@@ -314,6 +315,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';
@@ -364,7 +374,7 @@ LogSWrite(int verb, const char *buf, size_t len, Bool end_line)
if (verb < 0 || logFileVerbosity >= verb) {
if (inSignalContext && logFileFd >= 0) {
write(logFileFd, buf, len);
-#ifdef WIN32
+#ifndef WIN32
if (logFlush && logSync)
fsync(logFileFd);
#endif
@@ -457,6 +467,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);
@@ -464,13 +475,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);
@@ -556,6 +571,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);
@@ -563,13 +579,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 947f8673a..04bcbc61f 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -1924,6 +1924,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