projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.00.tar.gz
[xscreensaver]
/
driver
/
xscreensaver-getimage.c
diff --git
a/driver/xscreensaver-getimage.c
b/driver/xscreensaver-getimage.c
index c8e8228b6820af6711b371f9ab2a80637c378deb..c5c302996315fd5e1352692292a9ac145603587c 100644
(file)
--- a/
driver/xscreensaver-getimage.c
+++ b/
driver/xscreensaver-getimage.c
@@
-18,6
+18,16
@@
#include <X11/Intrinsic.h>
#include <errno.h>
#include <X11/Intrinsic.h>
#include <errno.h>
+#ifdef HAVE_XMU
+# ifndef VMS
+# include <X11/Xmu/Error.h>
+# else /* VMS */
+# include <Xmu/Error.h>
+# endif
+#else
+# include "xmu.h"
+#endif
+
#include "yarandom.h"
#include "grabscreen.h"
#include "resources.h"
#include "yarandom.h"
#include "grabscreen.h"
#include "resources.h"
@@
-94,6
+104,18
@@
exec_error (char **av)
exit (1);
}
exit (1);
}
+static int
+x_ehandler (Display *dpy, XErrorEvent *error)
+{
+ fprintf (stderr, "\nX error in %s:\n", progname);
+ if (XmuPrintDefaultErrorMessage (dpy, error, stderr))
+ exit (-1);
+ else
+ fprintf (stderr, " (nonfatal.)\n");
+ return 0;
+}
+
+
static void
get_image (Screen *screen, Window window, Bool verbose_p)
static void
get_image (Screen *screen, Window window, Bool verbose_p)
@@
-106,9
+128,6
@@
get_image (Screen *screen, Window window, Bool verbose_p)
enum { do_desk, do_video, do_image, do_bars } which = do_bars;
int count = 0;
enum { do_desk, do_video, do_image, do_bars } which = do_bars;
int count = 0;
- if (desk_p) count++;
- if (video_p) count++;
- if (image_p) count++;
if (verbose_p)
{
if (verbose_p)
{
@@
-146,7
+165,17
@@
get_image (Screen *screen, Window window, Bool verbose_p)
know it's not a security problem to expose desktop bits.)
*/
know it's not a security problem to expose desktop bits.)
*/
- if (window != VirtualRootWindowOfScreen (screen))
+ if ((desk_p || video_p || image_p) &&
+ !top_level_window_p (screen, window))
+ {
+ desk_p = False;
+ video_p = False;
+ image_p = False;
+ if (verbose_p)
+ fprintf (stderr, "%s: not a top-level window: using colorbars.\n",
+ progname);
+ }
+ else if (window != VirtualRootWindowOfScreen (screen))
{
Bool changed_p = False;
if (!desk_p) desk_p = True, changed_p = True;
{
Bool changed_p = False;
if (!desk_p) desk_p = True, changed_p = True;
@@
-158,6
+187,11
@@
get_image (Screen *screen, Window window, Bool verbose_p)
progname);
}
progname);
}
+ count = 0;
+ if (desk_p) count++;
+ if (video_p) count++;
+ if (image_p) count++;
+
if (count == 0)
which = do_bars;
else
if (count == 0)
which = do_bars;
else
@@
-306,6
+340,8
@@
main (int argc, char **argv)
db = XtDatabase (dpy);
XtGetApplicationNameAndClass (dpy, &s, &progclass);
db = XtDatabase (dpy);
XtGetApplicationNameAndClass (dpy, &s, &progclass);
+ XSetErrorHandler (x_ehandler);
+ XSync (dpy, False);
/* half-assed way of avoiding buffer-overrun attacks. */
if (strlen (progname) >= 100) progname[100] = 0;
/* half-assed way of avoiding buffer-overrun attacks. */
if (strlen (progname) >= 100) progname[100] = 0;