From 7bc4cffcc7f8e921a48cb3250ebcfc9b02d0f906 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sat, 20 Dec 2014 01:57:02 -0600 Subject: [PATCH] wmitime: Allow -display option with no argument Previously, if a user ran wmitime with the -display option and no argument, a segmentation fault would occur. Print a warning instead. Patch from Debian [1] to fix bug #716466 [2]. [1] http://sources.debian.net/src/wmitime/0.3%2B20120605-1/debian/patches/allow_display_with_no_args.patch/ [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=716466 --- wmitime/wmgeneral/wmgeneral.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wmitime/wmgeneral/wmgeneral.c b/wmitime/wmgeneral/wmgeneral.c index c064b39..fb8a8f4 100644 --- a/wmitime/wmgeneral/wmgeneral.c +++ b/wmitime/wmgeneral/wmgeneral.c @@ -385,7 +385,11 @@ void openXwindow(int argc, char *argv[], char *pixmap_bytes[], char *pixmask_bit for (i=1; argv[i]; i++) { if (!strcmp(argv[i], "-display")) { display_name = argv[i+1]; - i++; + if (!display_name) + printf("Please provide an argument for " + "-display.\n"); + else + i++; } if (!strcmp(argv[i], "-geometry")) { geometry = argv[i+1];