aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/os
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-19 12:11:26 +0200
committermarha <marha@users.sourceforge.net>2011-10-19 12:11:26 +0200
commit1e90ede4237374dfbb2c8c506a906233bcfd3c5d (patch)
tree13b59b0ab2715fd0bb9eea788c73b08f3b07c01e /xorg-server/os
parentbaf98f9bb36f956245d83ecd04f90625d6d68d2b (diff)
parent9f986778bd4393c5a9108426969d45aa7f10f334 (diff)
downloadvcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.gz
vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.bz2
vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/include/os.h
Diffstat (limited to 'xorg-server/os')
-rw-r--r--xorg-server/os/backtrace.c5
-rw-r--r--xorg-server/os/log.c14
-rw-r--r--xorg-server/os/utils.c4
-rw-r--r--xorg-server/os/xprintf.c5
4 files changed, 8 insertions, 20 deletions
diff --git a/xorg-server/os/backtrace.c b/xorg-server/os/backtrace.c
index 7ca6dab6d..58b4b1f34 100644
--- a/xorg-server/os/backtrace.c
+++ b/xorg-server/os/backtrace.c
@@ -27,6 +27,8 @@
#include "os.h"
#include "misc.h"
+#include <errno.h>
+#include <string.h>
#ifdef HAVE_BACKTRACE
#ifndef _GNU_SOURCE
@@ -199,9 +201,8 @@ void xorg_backtrace(void) {
walkcontext(&u, xorg_backtrace_frame, &depth);
else
# endif
- Error("Failed to get backtrace info");
+ ErrorF("Failed to get backtrace info: %s\n", strerror(errno));
}
- ErrorF("\n");
}
# else
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c
index 77a389a43..cf0e01518 100644
--- a/xorg-server/os/log.c
+++ b/xorg-server/os/log.c
@@ -87,7 +87,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/stat.h>
#include <stdarg.h>
#include <stdlib.h> /* for malloc() */
-#include <errno.h>
#include "input.h"
#include "site.h"
@@ -650,19 +649,6 @@ ErrorF(const char * f, ...)
va_end(args);
}
-/* A perror() workalike. */
-
-void
-Error(const char *str)
-{
- const char *err = strerror(errno);
-
- if (str)
- LogWrite(-1, "%s: %s", str, err);
- else
- LogWrite(-1, "%s", err);
-}
-
void
LogPrintMarkers(void)
{
diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c
index 8fd034af7..30ffb4373 100644
--- a/xorg-server/os/utils.c
+++ b/xorg-server/os/utils.c
@@ -318,7 +318,7 @@ LockServer(void)
FatalError("Could not create lock file in %s\n", tmp);
(void) sprintf(pid_str, "%10ld\n", (long)getpid());
(void) write(lfd, pid_str, 11);
- (void) chmod(tmp, 0444);
+ (void) fchmod(lfd, 0444);
(void) close(lfd);
/*
@@ -339,7 +339,7 @@ LockServer(void)
/*
* Read the pid from the existing file
*/
- lfd = open(LockFile, O_RDONLY);
+ lfd = open(LockFile, O_RDONLY|O_NOFOLLOW);
if (lfd < 0) {
unlink(tmp);
FatalError("Can't read lock file %s\n", LockFile);
diff --git a/xorg-server/os/xprintf.c b/xorg-server/os/xprintf.c
index cc5a9b355..fecaa1443 100644
--- a/xorg-server/os/xprintf.c
+++ b/xorg-server/os/xprintf.c
@@ -64,6 +64,8 @@
#include "os.h"
#include <stdarg.h>
#include <stdio.h>
+#include <errno.h>
+#include <string.h>
#ifdef asprintf
# undef asprintf
@@ -161,8 +163,7 @@ XNFvasprintf(char **ret, const char * _X_RESTRICT_KYWD format, va_list va)
{
int size = vasprintf(ret, format, va);
if ((size == -1) || (*ret == NULL)) {
- Error("XNFvasprintf");
- FatalError("XNFvasprintf failed");
+ FatalError("XNFvasprintf failed: %s", strerror(errno));
}
return size;
}