[PATCH xfs 2/3] Define VErrorF and then try to get libxtrans to use our error log

Keith Packard keithp at keithp.com
Wed Jan 29 13:14:23 PST 2014


libxtrans uses private versions of ErrorF/VErrorF for error logging in
the font server, which means that all transport related error messages
are currently not getting into the font server log file.

This patch provides the necessary VErrorF API and then defines the new
TRANS_HAS_ERRORF symbol to ask libxtrans to use the local logging
functions instead of its own.

There is a related patch to libxtrans which uses this symbol.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 include/os.h  |  3 +++
 os/error.c    | 14 ++++++++++----
 os/xfstrans.c |  1 +
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/os.h b/include/os.h
index e07d4e0..0a5be84 100644
--- a/include/os.h
+++ b/include/os.h
@@ -48,6 +48,8 @@ in this Software without prior written authorization from The Open Group.
 #ifndef	_OS_H_
 #define	_OS_H_
 
+#include <stdarg.h>
+
 typedef struct _FontPathRec *FontPathPtr;
 typedef struct _alt_server *AlternateServerPtr;
 typedef struct _auth *AuthPtr;
@@ -101,6 +103,7 @@ extern void	InitErrors(void);
 extern void	CloseErrors(void);
 extern void	NoticeF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2);
 extern void	ErrorF(const char * f, ...) _X_ATTRIBUTE_PRINTF(1, 2);
+extern void     VErrorF(const char * f, va_list args) _X_ATTRIBUTE_PRINTF(1, 0);
 extern void	FatalError(const char* f, ...) _X_ATTRIBUTE_PRINTF(1, 2);
 
 /* os/io.c */
diff --git a/os/error.c b/os/error.c
index d868ede..7d2729b 100644
--- a/os/error.c
+++ b/os/error.c
@@ -146,11 +146,8 @@ Error(const char *str)
  * used for informational messages
  */
 void
-NoticeF(const char *f, ...)
+VErrorF(const char *f, va_list args)
 {
-    /* XXX should Notices just be ignored if not using syslog? */
-    va_list args;
-    va_start(args, f);
 #ifdef USE_SYSLOG
     if (UseSyslog) {
 	vsyslog(LOG_NOTICE, f, args);
@@ -160,6 +157,15 @@ NoticeF(const char *f, ...)
     fprintf(stderr, "%s notice: ", progname);
     vfprintf(stderr, f, args);
 #endif /* USE_SYSLOG */
+}
+
+void
+NoticeF(const char *f, ...)
+{
+    /* XXX should Notices just be ignored if not using syslog? */
+    va_list args;
+    va_start(args, f);
+    VErrorF(f, args);
     va_end(args);
 }
 
diff --git a/os/xfstrans.c b/os/xfstrans.c
index bb1b12a..0dfeb59 100644
--- a/os/xfstrans.c
+++ b/os/xfstrans.c
@@ -24,6 +24,7 @@
 
 #define FONT_t 1
 #define TRANS_REOPEN 1
+#define TRANS_HAS_ERRORF 1
 #define TRANS_SERVER 1
 
 #include <X11/Xtrans/transport.c>
-- 
1.8.5.3



More information about the xorg-devel mailing list