[X2Go-Commits] [nx-libs] 17/29: Error.c: update nxagentPrintError

git-admin at x2go.org git-admin at x2go.org
Sun Jan 7 01:30:59 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 96e430069b24e0a4cd53e47e38786802999d31f4
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Wed Jan 3 00:18:39 2018 +0100

    Error.c: update nxagentPrintError
    
    This is a partial copy from XlibInt.c's _XPrintDefaultError, which had
    some minor changes since being copied. Update to reflect these
    changes. Also comment some more lines as their result was unused an
    cluttered the output.
---
 nx-X11/programs/Xserver/hw/nxagent/Error.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Error.c b/nx-X11/programs/Xserver/hw/nxagent/Error.c
index 7420a8b..4493840 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Error.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Error.c
@@ -118,6 +118,8 @@ int nxagentErrorHandler(Display *dpy, XErrorEvent *event)
 
 /* copied from XlibInt.c */
 /* extension stuff roughly commented out */
+/* FIXME: why? What's wrong with printing extension stuff?
+   We could drop this in favour of _XprintDefaultError then! */
 static int nxagentPrintError(dpy, event, fp)
     Display *dpy;
     XErrorEvent *event;
@@ -138,7 +140,7 @@ static int nxagentPrintError(dpy, event, fp)
 	mesg, BUFSIZ);
     (void) fprintf(fp, mesg, event->request_code);
     if (event->request_code < 128) {
-	sprintf(number, "%d", event->request_code);
+	snprintf(number, sizeof(number), "%d", event->request_code);
 	XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
     } else {
       /*	for (ext = dpy->ext_procs;
@@ -146,7 +148,7 @@ static int nxagentPrintError(dpy, event, fp)
 	     ext = ext->next)
 	  ;
 	if (ext)
-	    strcpy(buffer, ext->name);
+	    strncpy(buffer, ext->name, BUFSIZ);
 	else
       */
 	    buffer[0] = '\0';
@@ -159,7 +161,7 @@ static int nxagentPrintError(dpy, event, fp)
 	(void) fprintf(fp, mesg, event->minor_code);
 	/*
 	if (ext) {
-	    sprintf(mesg, "%s.%d", ext->name, event->minor_code);
+	    snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code);
 	    XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
 	    (void) fprintf(fp, " (%s)", buffer);
 	}
@@ -184,7 +186,7 @@ static int nxagentPrintError(dpy, event, fp)
 		bext = ext;
 	}
 	if (bext)
-	    sprintf(buffer, "%s.%d", bext->name,
+	    snprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
 		    event->error_code - bext->codes.first_error);
 	else
 	*/
@@ -229,10 +231,10 @@ static int nxagentPrintError(dpy, event, fp)
 			  mesg, BUFSIZ);
     fputs("  ", fp);
     (void) fprintf(fp, mesg, event->serial);
-    XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
+    /*    XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
 			  mesg, BUFSIZ);
     fputs("\n  ", fp);
-    /*    (void) fprintf(fp, mesg, dpy->request); */
+    (void) fprintf(fp, mesg, dpy->request); */
     fputs("\n", fp);
     if (event->error_code == BadImplementation) return 0;
     return 1;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list