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.04.2.tar.gz
[xscreensaver]
/
driver
/
remote.c
diff --git
a/driver/remote.c
b/driver/remote.c
index b8ab8e15087fd79a5b594af177c80063bfedd975..2ecd7cbb70671fbfc8c095c7f1b3ab0ba91739eb 100644
(file)
--- a/
driver/remote.c
+++ b/
driver/remote.c
@@
-16,6
+16,7
@@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/types.h>
@@
-82,7
+83,7
@@
find_screensaver_window (Display *dpy, char **version)
if (parent)
abort ();
if (! (kids && nkids))
if (parent)
abort ();
if (! (kids && nkids))
-
abort ()
;
+
return 0
;
for (i = 0; i < nkids; i++)
{
Atom type;
for (i = 0; i < nkids; i++)
{
Atom type;
@@
-118,11
+119,15
@@
find_screensaver_window (Display *dpy, char **version)
if (status == Success && type != None)
{
if (status == Success && type != None)
{
+ Window ret = kids[i];
if (version)
*version = v;
if (version)
*version = v;
- return kids[i];
+ XFree (kids);
+ return ret;
}
}
}
}
+
+ if (kids) XFree (kids);
return 0;
}
return 0;
}
@@
-131,6
+136,7
@@
static int
send_xscreensaver_command (Display *dpy, Atom command, long arg,
Window *window_ret, char **error_ret)
{
send_xscreensaver_command (Display *dpy, Atom command, long arg,
Window *window_ret, char **error_ret)
{
+ int status = -1;
char *v = 0;
Window window = find_screensaver_window (dpy, &v);
XWindowAttributes xgwa;
char *v = 0;
Window window = find_screensaver_window (dpy, &v);
XWindowAttributes xgwa;
@@
-147,15
+153,20
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
if (error_ret)
{
*error_ret = strdup (err);
if (error_ret)
{
*error_ret = strdup (err);
- return -1;
+ status = -1;
+ goto DONE;
}
if (command == XA_EXIT)
}
if (command == XA_EXIT)
- /* Don't print an error if xscreensaver is already dead. */
- return 1;
+ {
+ /* Don't print an error if xscreensaver is already dead. */
+ status = 1;
+ goto DONE;
+ }
fprintf (stderr, "%s: %s\n", progname, err);
fprintf (stderr, "%s: %s\n", progname, err);
- return -1;
+ status = -1;
+ goto DONE;
}
/* Select for property change events, so that we can read the response. */
}
/* Select for property change events, so that we can read the response. */
@@
-175,7
+186,9
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
- return -1;
+
+ status = -1;
+ goto DONE;
}
XGetClassHint(dpy, window, &hint);
}
XGetClassHint(dpy, window, &hint);
@@
-187,7
+200,10
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
- return -1;
+
+ if (v) free (v);
+ status = -1;
+ goto DONE;
}
fprintf (stdout, "%s %s", hint.res_class, v);
}
fprintf (stdout, "%s %s", hint.res_class, v);
@@
-224,7
+240,8
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
fprintf (stdout, "\n");
fflush (stdout);
fprintf (stderr, "bad status format on root window.\n");
fprintf (stdout, "\n");
fflush (stdout);
fprintf (stderr, "bad status format on root window.\n");
- return -1;
+ status = -1;
+ goto DONE;
}
blanked = (Atom) data[0];
}
blanked = (Atom) data[0];
@@
-285,12
+302,14
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
fprintf (stdout, "\n");
fflush (stdout);
fprintf (stderr, "no saver status on root window.\n");
fprintf (stdout, "\n");
fflush (stdout);
fprintf (stderr, "no saver status on root window.\n");
- return -1;
+ status = -1;
+ goto DONE;
}
}
/* No need to read a response for these commands. */
}
}
/* No need to read a response for these commands. */
- return 1;
+ status = 1;
+ goto DONE;
}
else
{
}
else
{
@@
-325,11
+344,17
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
*error_ret = strdup (err);
else
fprintf (stderr, "%s: %s\n", progname, err);
- return -1;
+ status = -1;
+ goto DONE;
}
}
}
}
+
+ status = 0;
+
+ DONE:
+ if (v) free (v);
XSync (dpy, 0);
XSync (dpy, 0);
- return
0
;
+ return
status
;
}
}