diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index aba4869f8..d5d29b123 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -519,13 +519,19 @@ 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... */ XkbSetRulesDflts(&rmlvo); - assert(Success == AllocDevicePair(serverClient, "xquartz virtual", - &darwinPointer, &darwinKeyboard, - DarwinMouseProc, DarwinKeybdProc, FALSE)); + result = AllocDevicePair(serverClient, "xquartz virtual", + &darwinPointer, &darwinKeyboard, + DarwinMouseProc, DarwinKeybdProc, FALSE); + if (result != Success) { + FatalError("InitInput: AllocDevicePair (...,\"xquartz virtual\",...) " + "returned X windows error %d.\n", + result); + } /* here's the snippet from the current gdk sources: if (!strcmp (tmp_name, "pointer")) @@ -542,15 +548,26 @@ InitInput(int argc, char **argv) */ darwinTabletStylus = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletStylus); + if (!darwinTabletStylus) { + FatalError("InitInput: " + "AddInputDevice(serverClient, DarwinTabletProc, TRUE) " + "failed.\n"); + } + darwinTabletStylus->name = strdup("pen"); darwinTabletCursor = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletCursor); + if(!darwinTabletCursor) { + FatalError("InitInput: " + "AddInputDevice(serverClient, DarwinTabletProc, TRUE) " + "failed.\n"); + } darwinTabletCursor->name = strdup("cursor"); darwinTabletEraser = AddInputDevice(serverClient, DarwinTabletProc, TRUE); - assert(darwinTabletEraser); + if(!darwinTabletEraser) { + FatalError("InitInput: AddInputDevice(serverClient, DarwinTabletProc, TRUE) failed.\n"); + } darwinTabletEraser->name = strdup("eraser"); DarwinEQInit(); @@ -679,8 +696,18 @@ OsVendorInit(void) if (serverGeneration == 1) { char *lf; char *home = getenv("HOME"); - assert(home); - assert(0 < asprintf(&lf, "%s/Library/Logs/X11", home)); + int nbytes; + + if (!home) { + FatalError("darwin OsVendorInit: " + "getenv(\"HOME\") returned NULL.\n"); + } + + nbytes = asprintf(&lf, "%s/Library/Logs/X11", home); + if (nbytes <= 0) { + FatalError("darwin OsVendorInit: " + "asprintf of log directory name failed.\n"); + } /* Ignore errors. If EEXIST, we don't care. If anything else, * LogInit will handle it for us. @@ -688,9 +715,12 @@ OsVendorInit(void) (void)mkdir(lf, S_IRWXU | S_IRWXG | S_IRWXO); free(lf); - 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); + if (nbytes <= 0) { + FatalError("darwin OsVendorInit: " + "asprintf of log file name failed.\n"); + } LogInit(lf, ".old"); free(lf);