On Tue, Nov 21 2017, Theo Buehler <t...@openbsd.org> wrote: > On Tue, Nov 21, 2017 at 12:25:38AM -0700, Anthony J. Bentley wrote: >> Theo Buehler writes: >> > $ unset DISPLAY; xclip >> > Error: Can't open display: (null) >> > $ tail -1 /var/log/messages >> > Nov 18 11:53:55 mimine xclip: vfprintf %s NULL in "Error: Can't open >> > display: >> > %s " >> > >> > ok? >> > >> > Index: Makefile >> > =================================================================== >> > RCS file: /var/cvs/ports/x11/xclip/Makefile,v >> > retrieving revision 1.15 >> > diff -u -p -r1.15 Makefile >> > --- Makefile 13 Sep 2016 20:13:38 -0000 1.15 >> > +++ Makefile 18 Nov 2017 10:56:55 -0000 >> > @@ -4,6 +4,7 @@ COMMENT= command line interface to X se >> > GH_ACCOUNT= astrand >> > GH_PROJECT= xclip >> > GH_TAGNAME= 0.13 >> > +REVISION= 0 >> > CATEGORIES= x11 >> > >> > MAINTAINER= Dmitrij D. Czarkoff <czark...@openbsd.org> >> > Index: patches/patch-xcprint_c >> > =================================================================== >> > RCS file: patches/patch-xcprint_c >> > diff -N patches/patch-xcprint_c >> > --- /dev/null 1 Jan 1970 00:00:00 -0000 >> > +++ patches/patch-xcprint_c 18 Nov 2017 10:55:49 -0000 >> > @@ -0,0 +1,19 @@ >> > +$OpenBSD$ >> > + >> > +Avoid printf "%s" NULL >> > + >> > +Index: xcprint.c >> > +--- xcprint.c.orig >> > ++++ xcprint.c >> > +@@ -86,7 +86,10 @@ errxdisplay(char *display) >> > + if (display == NULL) >> > + display = getenv("DISPLAY"); >> > + >> > +- fprintf(stderr, "Error: Can't open display: %s\n", display); >> > ++ if (display == NULL || *display == '\0') >> > ++ fprintf(stderr, "Error: Can't open display\n"); >> > ++ else >> > ++ fprintf(stderr, "Error: Can't open display: %s\n", display); >> > + exit(EXIT_FAILURE); >> > + } >> > + >> >> This makes the error vague when you actually have DISPLAY unset, e.g., >> ssh'd into the wrong machine... I would prefer to keep the same output >> in the null case. > > Alright, let's do the usual thing, then. I didn't wrap the line because > there are longer lines already.
ok jca@ > Index: Makefile > =================================================================== > RCS file: /var/cvs/ports/x11/xclip/Makefile,v > retrieving revision 1.15 > diff -u -p -r1.15 Makefile > --- Makefile 13 Sep 2016 20:13:38 -0000 1.15 > +++ Makefile 18 Nov 2017 10:56:55 -0000 > @@ -4,6 +4,7 @@ COMMENT= command line interface to X se > GH_ACCOUNT= astrand > GH_PROJECT= xclip > GH_TAGNAME= 0.13 > +REVISION= 0 > CATEGORIES= x11 > > MAINTAINER= Dmitrij D. Czarkoff <czark...@openbsd.org> > Index: patches/patch-xcprint_c > =================================================================== > RCS file: patches/patch-xcprint_c > diff -N patches/patch-xcprint_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ patches/patch-xcprint_c 21 Nov 2017 08:35:08 -0000 > @@ -0,0 +1,16 @@ > +$OpenBSD$ > + > +Avoid printf "%s" NULL > + > +Index: xcprint.c > +--- xcprint.c.orig > ++++ xcprint.c > +@@ -86,7 +86,7 @@ errxdisplay(char *display) > + if (display == NULL) > + display = getenv("DISPLAY"); > + > +- fprintf(stderr, "Error: Can't open display: %s\n", display); > ++ fprintf(stderr, "Error: Can't open display: %s\n", display ? display : > "(null)"); > + exit(EXIT_FAILURE); > + } > + > -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE