X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fgrabclient.c;h=438197e80da1ff1eb2b4db6dcbb9d8e5a47c7cae;hb=50be9bb40dc60130c99ffa568e6677779904ff70;hp=8f6778bc0d3b0ff66cf7cb33c12730eb4d972c8c;hpb=49f5b54f312fe4ac2e9bc47581a72451bd0e8439;p=xscreensaver diff --git a/utils/grabclient.c b/utils/grabclient.c index 8f6778bc..438197e8 100644 --- a/utils/grabclient.c +++ b/utils/grabclient.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992-2006 Jamie Zawinski +/* xscreensaver, Copyright (c) 1992-2010 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -31,6 +31,8 @@ # include /* for XtInputId, etc */ #endif /* !HAVE_COCOA */ +#include + #ifdef HAVE_UNISTD_H # include #endif @@ -247,6 +249,11 @@ hack_subproc_environment (Display *dpy) if (putenv (ndpy)) abort (); #endif /* HAVE_PUTENV */ + + /* don't free (ndpy) -- some implementations of putenv (BSD 4.4, + glibc 2.0) copy the argument, but some (libc4,5, glibc 2.1.2, MacOS) + do not. So we must leak it (and/or the previous setting). Yay. + */ } @@ -575,6 +582,21 @@ pipe_cb (XtPointer closure, int *source, XtInputId *id) Window r; int x, y; unsigned int w, h, bbw, d; + struct stat st; + + /* Log something to syslog so we can tell the difference between + corrupted images and broken symlinks. */ + if (!*buf) + fprintf (stderr, "%s: no image filename found\n", progname); + else if (! stat (buf, &st)) + fprintf (stderr, "%s: %s: unparsable\n", progname, buf); + else + { + char buf2[2048]; + sprintf (buf2, "%.255s: %.1024s", progname, buf); + perror (buf2); + } + XGetGeometry (dpy, clo2->drawable, &r, &x, &y, &w, &h, &bbw, &d); draw_colorbars (clo2->screen, xgwa.visual, clo2->drawable, xgwa.colormap, 0, 0, w, h); @@ -657,6 +679,8 @@ load_random_image_1 (Screen *screen, Window window, Drawable drawable, XRectangle geom_ret_2; char *name_ret_2 = 0; + if (!drawable) abort(); + if (callback) { geom_ret = &geom_ret_2; name_ret = &name_ret_2; @@ -706,11 +730,9 @@ load_random_image_1 (Screen *screen, Window window, Drawable drawable, done = True; } - if (! done) { + if (! done) draw_colorbars (screen, xgwa.visual, drawable, xgwa.colormap, 0, 0, xgwa.width, xgwa.height); - done = True; - } if (callback) { /* If we got here, we loaded synchronously even though they wanted async.