projects
/
xscreensaver
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.06.tar.gz
[xscreensaver]
/
driver
/
remote.c
diff --git
a/driver/remote.c
b/driver/remote.c
index b8ab8e15087fd79a5b594af177c80063bfedd975..3c6e4d1e4a04c3114915c6be28cfa2e07508ab32 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];
@@
-261,13
+278,13
@@
send_xscreensaver_command (Display *dpy, Atom command, long arg,
}
if (any && nhacks == 1)
}
if (any && nhacks == 1)
- fprintf (stdout, " (hack #%d)\n", data[2]);
+ fprintf (stdout, " (hack #%d)\n",
(int)
data[2]);
else if (any)
{
fprintf (stdout, " (hacks: ");
for (i = 0; i < nhacks; i++)
{
else if (any)
{
fprintf (stdout, " (hacks: ");
for (i = 0; i < nhacks; i++)
{
- fprintf (stdout, "#%d", data[2 + i]);
+ fprintf (stdout, "#%d",
(int)
data[2 + i]);
if (i != nhacks-1)
fputs (", ", stdout);
}
if (i != nhacks-1)
fputs (", ", stdout);
}
@@
-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
;
}
}