Commit Graph

91 Commits

Author SHA1 Message Date
Adam Jackson
89a9927b1e include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
Adam Jackson
4ebce1ed8b os: Move log verbosity defaults into os/log.c
There's not any configuration knobs for this so there's no real reason
to leave them in a configgy header.
2019-10-30 16:17:04 +00:00
Matthieu Herrb
248d164eae LogFilePrep: add a comment to the unsafe format string.
CVE-2018-14665 also made it possible to exploit this to access
memory. With -logfile forbidden when running with elevated privileges
this is no longer an issue.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-10-25 09:17:11 -04:00
Adam Jackson
a23eba2a91 dix: Merge AbortDDX into ddxGiveUp
These are so close to identical that most DDXes implement one in terms
of the other. All the relevant cases can be distinguished by the error
code, so merge the functions together to make things simpler.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-09-28 16:25:12 -04:00
Antoine Martin
c95361465e os: Fix -logfile when used with -displayfd
Trivial way to reproduce the bug:

$ Xorg -logfile /tmp/mylog -config /etc/xpra/xorg.conf -displayfd 2

The server then moans:

Failed to rename log file "/tmp/mylog" to "/tmp/mylog": No such file or directory

And the log file is created but immediately renamed to "/tmp/mylog.old".
This is caused by the changes to the log file handling introduced by
this commit:

https://cgit.freedesktop.org/xorg/xserver/commit/?id=edcb6426f20c3be5dd5f50b76a686754aef2f64e

To fix this, only rename the logfile if the log filename contains the
magic substitution string "%s".

Signed-off-by: Antoine Martin <antoine@nagafix.co.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-03-28 15:16:02 -04:00
Adam Jackson
6dcb73375e os: Failure to remove a non-existent log file is not an error
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-01-06 12:23:31 -05:00
Alan Coopersmith
edcb6426f2 Use unique logfile names when starting server with -displayfd
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=93212

Previously all X servers started with -displayfd would overwrite
Xorg.0.log - now a temporary name of Xorg.pid-<pid>.log is used
until after -displayfd finds an open display - then it is renamed
to the traditional Xorg.<display>.log name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2016-01-05 14:51:16 -05:00
Jon TURNEY
d3080d421b os: Teach vpnprintf() how to handle "%*.*s"
XdmcpFatal uses the format specifier %*.*s, which vpnprintf() doesn't
understand, which causes a backtrace and prevents the reason for the XDMCP
failure being logged.

See also:
https://bugs.freedesktop.org/show_bug.cgi?id=66862
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758574

"%*.*s" is also currently used in a few other places, so teach vpnprintf() how
to handle it

$ fgrep -r "%*.*s" *
hw/dmx/config/scanner.l:    fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
hw/dmx/dmxlog.c:        ErrorF("(%s) dmx[i%d/%*.*s]: ", type,
hw/dmx/input/dmxinputinit.c:                dmxLogCont(dmxInfo, "\t[i%d/%*.*s",
os/access.c:        ErrorF("Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
os/access.c:                ("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
os/xdmcp.c:    FatalError("XDMCP fatal error: %s %*.*s\n", type,

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-03-16 16:34:50 +00:00
Aaron Plattner
c299400168 os: "Server terminated successfully" is not an error
ErrorFSigSafe calls LogVMessageVerbSigSafe with the message type set to X_ERROR.
That generates this in the log:

  (EE) Server terminated successfully (0). Closing log file.

People periodically report this as an error, sometimes quoting this "error"
rather than an earlier error that actually caused a problem.

v2: Use X_INFO instead of X_NOTICE

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-11-30 11:35:02 -08:00
Peter Hutterer
732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Jon TURNEY
28337cb14e xserver: Move 'pragma GCC diagnostic' outside functions
$ gcc --version
gcc (Gentoo 4.4.3-r2 p1.2) 4.4.3

/jhbuild/checkout/xorg/xserver/os/log.c: In function ‘LogInit’:
/jhbuild/checkout/xorg/xserver/os/log.c:199: error: #pragma GCC diagnostic not allowed inside functions
/jhbuild/checkout/xorg/xserver/os/log.c:201: warning: format not a string literal, argument types not checked
/jhbuild/checkout/xorg/xserver/os/log.c:212: error: #pragma GCC diagnostic not allowed inside functions
/jhbuild/checkout/xorg/xserver/os/log.c:214: warning: format not a string literal, argument types not checked

etc.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-18 22:28:27 -07:00
Thomas Petazzoni
7a0c79c8c4 os/log: adjust gcc version conditions for #pragma
In commit e67f2d7e0f ("gcc 4.2.1 doesn't
support #pragma GCC diagnostic ignored"), some compile time
conditionals were added around the #pragma usage. Those conditionals
ensure that the #pragma are not used on gcc <= 4.2.

However, the usage of #pragma diagnostic inside functions was only
added in gcc 4.6, and a build failure is therefore experienced with
gcc 4.5:

log.c: In function 'LogInit':
log.c:199:9: error: #pragma GCC diagnostic not allowed inside functions
log.c:201:9: warning: format not a string literal, argument types not checked
log.c:212:9: error: #pragma GCC diagnostic not allowed inside functions
log.c:214:17: warning: format not a string literal, argument types not checked

$ ./host/usr/bin/powerpc-linux-gnu-gcc -v
[...]
gcc version 4.5.2 (Sourcery G++ Lite 2011.03-38)

This patch therefore adjusts the compile time conditionals to make
sure the #pragma is not used on gcc <= 4.5, and only used on gcc >=
4.6.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by:  Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-11 18:18:09 -07:00
Peter Hutterer
daa1a9d22d os: prevent negative array index access (#80890)
If an empty string is provided to LogMessageVerbSigSafe, the length of the
printed string is 0.

Read-only access only and the only effect it had was adding a linebreak or not.

X.Org Bug 80890 <http://bugs.freedesktop.org/show_bug.cgi?id=80890>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-10 10:24:04 +10:00
Peter Hutterer
d3a3ee7a0e os: automatically switch to sigsafe logging when needed
If we're smart enough to warn, we should be smart enough to just pass it
through to the right function. Worst case we lose some formatting specifiers
which pnprintf will complain about anyway. And in most cases it won't matter.

This requires renaming pnprintf to vpnprintf and changing the size_t to int to
be compatible with Xvscnprintf. pnprintf is internal only, the others are
exported API so we can't change them as easily.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-05-23 11:08:13 +10:00
Keith Packard
0af8788579 os: Ignore log file write failures
There's no place to log the message if writing to the log file fails,
and we surely don't want to crash in that case, so just ignore errors
and keep going.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2014-04-18 16:30:17 -07:00
Matthieu Herrb
e67f2d7e0f gcc 4.2.1 doesn't support #pragma GCC diagnostic ignored
Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-02-24 16:30:07 -08:00
Keith Packard
1ad8d12e7f Ignore a couple of format-nonliteral warnings
These are generated in code which uses sprintf as a convenient way to
construct strings from various pieces.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-22 19:56:31 -08:00
Keith Packard
60014a4a98 Replace 'pointer' type with 'void *'
This lets us stop using the 'pointer' typedef in Xdefs.h as 'pointer'
is used throughout the X server for other things, and having duplicate
names generates compiler warnings.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-01-12 10:24:11 -08:00
Jon TURNEY
59a6d3f1eb os: Remove any old logfile before trying to write to it
If we are not backing up logfiles, remove the old logfile before trying to write
a new logfile, as otherwise the operation may fail if the previous logfile was
created by a different user.

This change is useful when:
- The DDX doesn't use the logfile backup mechanism (i.e. not Xorg)
- The DDX is run by a non-root user, and then by a different non-root user
- The logfile directory doesn't have the restricted-deletion flag set

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Acked-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-11 07:39:03 +10:00
Peter Hutterer
042c6d861f os: Use ErrorFSigSafe from FatalError and it's friends
Backtrace logging etc. is already sigsafe, but the actual FatalError message
in response is not yet, leading to amusing logs like this:

    (EE) Segmentation fault at address 0x0
    (EE) BUG: triggered 'if (inSignalContext)'
    (EE) BUG: log.c:499 in LogVMessageVerb()
    (EE) 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:

    Fatal server error:

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:41:14 +10:00
Peter Hutterer
d9848fb4b1 os: complain about unsupported pnprintf directives
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:41:11 +10:00
Peter Hutterer
d903d17d7f os: support %c in pnprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:41:09 +10:00
Peter Hutterer
58ef34ee6d os: support %% in pnprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:41:07 +10:00
Peter Hutterer
5ea21560dd os: support pnprintf length modifiers for integers
Mainly for %ld, smaller than int is propagated anyway, and %lld isn't really
used.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-05-07 09:41:05 +10:00
Peter Hutterer
44fc062f85 os: document pnprintf as sigsafe snprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-03-06 09:23:20 +10:00
Peter Hutterer
9a35d4240e os: fix pnprintf OOB buffer read for unterminated length modifiers
Format strings with length modifiers but missing format specifier like "%0"
will read one byte past the array size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-02-14 11:01:21 -08:00
Peter Hutterer
9f79e93b6b Short-cut the input device cleanup process during AbortServer()
If we're about to abort, we're already in the signal handler and cannot call
down to the default device cleanup routines (which reset, free, alloc, and
do a bunch of other things).

Add a new DEVICE_ABORT mode to signal a driver's DeviceProc that it must
reset the hardware if needed but do nothing else. An actual HW reset is only
required for some drivers dealing with the HW directly.

This is largely backwards-compatible, hence the input ABI minor bump only.

Drivers we care about either return BadValue on a mode that's not
DEVICE_{INIT|ON|OFF|CLOSE} or print an error and return BadValue. Exception
here is vmmouse, which currently ignores it and would not reset anything.
This should be fixed if the reset is required.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-02-08 09:06:14 -08:00
Peter Hutterer
cde7cbe967 os: add support for %f to pnprintf
This is the lazy man's %f support. Print the decimal part of the number,
then append a decimal point, then print the first two digits of the
fractional part. So %f in sigsafe printing is really %.2f.

No boundary checks in place here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-17 17:17:41 +10:00
Peter Hutterer
20def57632 os: silently ignore length modifiers in pnprintf
Until we have support for them, ignore any length modifiers so we don't need
to update all callers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2013-01-17 17:17:38 +10:00
Peter Hutterer
24ffcfcded os: fix typo, fsync when WIN32 is _not_ defined
Introduced in 164b38c72f

Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2012-08-23 14:48:18 +10:00
Peter Hutterer
1ebba43052 os: don't block signal-unsafe logging, merely warn about it.
Throw an error into the log file, but continue anyway. And after three
warnings, stop complaining. Not all input drivers will be fixed in time (or
ever) and our printf implementation is vastly inferior, so there is still a
use-case for non-sigsafe logging.

This also adds more linebreaks to the message.

CC: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-21 07:54:07 +10:00
Peter Hutterer
4912b4adb6 os: add support for %d and %i to pnprintf
The mouse driver uses %i in some debug messages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-08-21 07:54:07 +10:00
Chase Douglas
82d1c6b310 Warn when attempting to log in a signal unsafe manner from signal context
Also, print out the offending message format. This will hopefully help
developers track down unsafe logging.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
ac20815d52 Add ErrorFSigSafe() alternative to ErrorF()
ErrorF() is not signal safe. Use ErrorSigSafe() whenever an error
message may be logged in signal context.

[whot: edited to "ErrorFSigSafe"]

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-07-02 22:34:32 -07:00
Chase Douglas
164b38c72f Add LogMessageVerbSigSafe() for logging messages while in signal context
[whot: edited to use varargs, squashed commit below]

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

os: fix vararg length calculation

Make %u and %x sizeof(unsigned int), %p sizeof(void*). This is printf
behaviour and we can't guarantee that void* is uint64_t anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-07-02 22:34:32 -07:00
Chase Douglas
bc85c81687 Save log file file descriptor for signal context logging
None of the FILE based functions are signal safe, including fileno(), so
we need to save the file descriptor for when we are in signal context.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-06-21 15:45:22 +10:00
Daniel Kurtz
c91d00e0f3 os/log: refactor logging
It is not safe to ever use an arbitrary (possibly user supplied) string as
part of the format for a *sprintf() call.

For example:
  1. Name a Bluetooth keyboard "%n%n%n%n%n%n%n%n"
  2. Pair it with a computer running X and try to use it
  3. X is not happy when trying to do the following in xf86-input-evdev:
     xf86IDrvMsg(pInfo, X_CONFIG, "Device: \"%s\"\n", device);
     because LogVHdrMessageVerb() has put the %n from the device name
     into a format string of the form:
        "evdev: %n%n%n%n%n%n%n%n: Device: \"%s\"\n"

Instead, build up a log message in place by appending successive formatted
strings by sncprintf'ing to the end of the previous.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-03 14:59:23 +10:00
Daniel Kurtz
6ce0eac4f8 os/log: only write timestamp if a message is actually written to logfile
The current code will write a timestamps into the logFile whenever
the last message ended with a '\n' - even if the verb for that timestamp
is at too high a level.  This timestamp will sit there with no matching
message until the next call to LogVWrite with a valid verb.

In other words, in some cases, timestamps in the X.org.log are for some
completely unrelated message that was previously ignored due to
insufficient verbosity, and not for the message that appears next to it
in the log file.

We keep the current policy which appears to be to only apply timestamps if
a message is actually written to a log file.  That is, no timestamps on
stderr, or in the mem buffer.  Therefore, the timestamp stringification
is moved to the conditional where it is used.

Since logging uses a fixed length buffer, this patch also forces a '\n'
whenever a buffer is terminated due to a too-long write request.  This
allows the newline detection to work even on overflow, and also cleans up
the log a bit in the overflow case.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-03 14:59:23 +10:00
Daniel Kurtz
c30862879d os/log: trivial cleanups
* space->tab
 * remove comment that doesn't make any sense

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-03 14:59:23 +10:00
Jeremy Huddleston
eca58ee4db os: Fix regression with FatalError not calling va_start
Regression From: a818b30598

Found-by: Colin Harrison <colin.harrison@virgin.net>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-03-30 14:42:11 -07:00
Jeremy Huddleston
a818b30598 os: Pass the FatalError message to OsVendorFatalError
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2012-03-24 01:07:05 -07:00
Peter Hutterer
14e3ea730e include: add an X_DEBUG message type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2012-03-22 11:33:21 +10:00
Keith Packard
9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Alan Coopersmith
f3cb512dc4 LogVMessageVerb: Fix const mismatch warning
"log.c", line 382: warning: assignment type mismatch:
	pointer to char "=" pointer to const char

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23 12:15:06 -08:00
Jeremy Huddleston
09dbfcb0ad os: Remove Error()
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-11 21:23:46 -07:00
Daniel Kurtz
b31d104fc0 os/log: Add LogVHdrMessageVerb and friends
LogVHdrMessageVerb allows a custom header to be inserted in a log message,
between the Log system's MessageType string, and a formatted variable
message body. The custom header can itself be a formatted variable string.

These functions can be used, for example, by driver abstraction layers to
format specific driver messages in a standard format, but do it in a way
that is efficient, obeys the log-layers verbosity settings, and is safe
to use in signal handlers (because they don't call malloc), even for
types besides X_NONE.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22 15:49:18 +10:00
Daniel Kurtz
b82f934db6 os/log: Pull LogMessageTypeVerbString out of LogVMessageVerb
Also, optimize how the type and format strings are combined.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-08-22 15:48:14 +10:00
Peter Hutterer
f51e42f583 Terminate the log with one last message.
Instead of just closing the log when everything is done, put one more
message in stating that we're actually terminating. Users or scripts that
look at the Xorg.log will then know that a) the server has terminated
properly and b) why the server terminated (to some degree, given that most
real-world errors will be caused by AbortServer()).

Acked-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-07-27 09:31:02 +10:00
Jeremy Huddleston
b47d2e43eb XQuartz: Make a copy of args for our crash reporter vsnprintf
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-05 09:04:41 -07:00
Jeremy Huddleston
c524f8bb76 os: Silence warnings when building with clang
access.c:1492:20: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses]
        if ((host->family == FamilyServerInterpreted)) {
             ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
access.c:1492:20: note: use '=' to turn this equality comparison into an assignment
        if ((host->family == FamilyServerInterpreted)) {
                          ^~
                          =
access.c:1492:20: note: remove extraneous parentheses around the comparison to silence this warning
        if ((host->family == FamilyServerInterpreted)) {
            ~             ^                         ~

In file included from xstrans.c:8:
In file included from /usr/X11/include/X11/Xtrans/transport.c:62:
/usr/X11/include/X11/Xtrans/Xtranssock.c:262:5: error: implicit declaration of function 'ErrorF' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    PRMSG (3,"SocketSelectFamily(%s)\n", family, 0, 0);
    ^

log.c:180:29: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
        if (asprintf(&logFileName, fname, display) == -1)
                                   ^~~~~
log.c:190:26: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
                if ((asprintf(&suffix, backup, display) == -1) ||
                                       ^~~~~~
log.c:382:25: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
        LogVWrite(verb, tmpBuf, args);
                        ^~~~~~

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
2011-04-25 10:45:34 -07:00