saver_preferences *p = &s->prefs;
char str[100];
+ /* The file supports timeouts of less than a minute, but the GUI does
+ not, so throttle the values to be at least one minute (since "0" is
+ a bad rounding choice...)
+ */
+# define THROTTLE(NAME) if (p->NAME != 0 && p->NAME < 60000) p->NAME = 60000
+ THROTTLE (timeout);
+ THROTTLE (cycle);
+ THROTTLE (passwd_timeout);
+# undef THROTTLE
+
# define FMT_MINUTES(NAME,N) \
- sprintf (str, "%d", ((N) + 59) / (60 * 1000)); \
+ sprintf (str, "%d", (((N / 1000) + 59) / 60)); \
gtk_entry_set_text (GTK_ENTRY (name_to_widget (s, (NAME))), str)
# define FMT_SECONDS(NAME,N) \
screenhack *hack = (hack_number >= 0 ? p->screenhacks[hack_number] : 0);
char *doc_string = 0;
+ /* #### not in Gtk 1.2
+ gtk_label_set_selectable (doc);
+ */
+
# ifdef HAVE_XML
if (s->cdata)
{
{
saver_preferences *p = &s->prefs;
Window id;
- char *new_cmd;
+ char *new_cmd = 0;
pid_t forked;
const char *cmd = s->desired_preview_cmd;
if (s->preview_suppressed_p)
{
kill_preview_subproc (s);
- return;
+ goto DONE;
}
new_cmd = malloc (strlen (cmd) + 40);
{
s->running_preview_error_p = True;
clear_preview_window (s);
- return;
+ goto DONE;
}
switch ((int) (forked = fork ()))
sprintf (buf, "%s: couldn't fork", blurb());
perror (buf);
s->running_preview_error_p = True;
- return;
+ goto DONE;
+ break;
}
case 0:
{
}
schedule_preview_check (s);
+
+ DONE:
+ if (new_cmd) free (new_cmd);
+ new_cmd = 0;
}
if (s->debug_p)
fprintf (stderr, "%s: %s\n", blurb(), ndpy);
+ /* 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) do not.
+ So we must leak it (and/or the previous setting). Yay.
+ */
+
if (def_path && *def_path)
{
const char *opath = getenv("PATH");
if (putenv (npath))
abort ();
+ /* do not free(npath) -- see above */
if (s->debug_p)
fprintf (stderr, "%s: added \"%s\" to $PATH\n", blurb(), def_path);
the_network_is_not_the_computer (state *s)
{
Display *dpy = GDK_DISPLAY();
- char *rversion, *ruser, *rhost;
+ char *rversion = 0, *ruser = 0, *rhost = 0;
char *luser, *lhost;
char *msg = 0;
struct passwd *p = getpwuid (getuid ());
if (*msg)
warning_dialog (s->toplevel_widget, msg, True, 1);
+ if (rversion) free (rversion);
+ if (ruser) free (ruser);
+ if (rhost) free (rhost);
free (msg);
}
}
#ifdef DEFAULT_ICONDIR /* from -D on compile line */
- add_pixmap_directory (DEFAULT_ICONDIR);
+ {
+ const char *dir = DEFAULT_ICONDIR;
+ if (*dir) add_pixmap_directory (dir);
+ }
#endif
/* This is gross, but Gtk understands --display and not -display...