Would any Apple user be kind enough to check this trivial X server patch?

Submitted by Adam Richter on May 2, 2019, 8:02 p.m.


Message ID CAGn-Tgg3AVh=wO7nE56z4rV-_z=W9piZdiyU2Jkxp0nO633bLA@mail.gmail.com
State New
Headers show
Series "Would any Apple user be kind enough to check this trivial X server patch?" ( rev: 1 ) in X.org

Not browsing as part of any series.

Commit Message

Adam Richter May 2, 2019, 8:02 p.m.

The attached patch fixes three places in hw/xquartz/darwin.c that
relied on side effects in assert parameters.  That is, they would fail
if assert() were replaced with a macro that did not evaluate its

I would appreciate it if anyone with an appropriate Apple system would
try this trivial patch and let me know the results.  Critiques of this
patch are also welcome, of course.  If I do not get a response to this
in the next day or two, I expect I will submit the patch on the gitlab
server, but having someone actually build and run it first would be
much better.

Thanks in advance for any responses.


Patch hide | download patch | download mbox

diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 5c7e96e87..1026bcf02 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -517,13 +517,15 @@  InitInput(int argc, char **argv)
         .rules   = "base", .model         = "empty", .layout = "empty",
         .variant = NULL,   .options       = NULL
+    int result;
     /* We need to really have rules... or something... */
-    assert(Success == AllocDevicePair(serverClient, "xquartz virtual",
-                                      &darwinPointer, &darwinKeyboard,
-                                      DarwinMouseProc, DarwinKeybdProc, FALSE));
+    result = AllocDevicePair(serverClient, "xquartz virtual",
+                             &darwinPointer, &darwinKeyboard,
+                             DarwinMouseProc, DarwinKeybdProc, FALSE);
+    assert(result == Success);
     /* here's the snippet from the current gdk sources:
        if (!strcmp (tmp_name, "pointer"))
@@ -677,8 +679,12 @@  OsVendorInit(void)
     if (serverGeneration == 1) {
         char *lf;
         char *home = getenv("HOME");
+        int nbytes;
-        assert(0 < asprintf(&lf, "%s/Library/Logs/X11", home));
+        nbytes = asprintf(&lf, "%s/Library/Logs/X11", home);
+        assert(nbytes > 0);
         /* Ignore errors.  If EEXIST, we don't care.  If anything else,
          * LogInit will handle it for us.
@@ -686,9 +692,9 @@  OsVendorInit(void)
         (void)mkdir(lf, S_IRWXU | S_IRWXG | S_IRWXO);
-        assert(0 <
-               asprintf(&lf, "%s/Library/Logs/X11/%s.log", home,
-                        bundle_id_prefix));
+        nbytes = asprintf(&lf, "%s/Library/Logs/X11/%s.log", home,
+                          bundle_id_prefix);
+        assert(nbytes > 0);
         LogInit(lf, ".old");