Index: suid.c =================================================================== RCS file: /cvs/gpe/base/gpe-conf/suid.c,v retrieving revision 1.54 diff -u -r1.54 suid.c --- suid.c 26 Oct 2004 15:04:22 -0000 1.54 +++ suid.c 28 Oct 2004 20:20:23 -0000 @@ -88,17 +88,25 @@ void update_time_from_net (const gchar * server) { + + if (setvbuf(nsreturn,NULL,_IONBF,0) != 0) + fprintf(stderr,"gpe-conf: error setting buffer size!"); + char *tstr = g_strdup_printf ("ntpdate -b %s", server); if (system(tstr)) { fprintf (stderr, "failed to execute ntpdate\n"); + fprintf(nsreturn,"\n"); } - else // if ok, update rtc time + else /* if ok, update rtc time */ { + fprintf(nsreturn,"\n"); system("/sbin/hwclock --systohc"); system ("echo > /var/spool/at/trigger"); } g_free(tstr); + fflush(nsreturn); + fsync(nsreturnfd); } Index: network.c =================================================================== RCS file: /cvs/gpe/base/gpe-conf/network.c,v retrieving revision 1.39 diff -u -r1.39 network.c --- network.c 26 Oct 2004 15:04:22 -0000 1.39 +++ network.c 28 Oct 2004 20:20:23 -0000 @@ -1416,7 +1416,9 @@ if (entry) { newval = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); - suid_exec ("SDNS", newval); + if (strlen(newval)) + suid_exec ("SDNS", newval); + g_free(newval); } } Index: timeanddate.c =================================================================== RCS file: /cvs/gpe/base/gpe-conf/timeanddate.c,v retrieving revision 1.37 diff -u -r1.37 timeanddate.c --- timeanddate.c 23 Aug 2004 22:33:01 -0000 1.37 +++ timeanddate.c 28 Oct 2004 20:20:23 -0000 @@ -17,18 +17,20 @@ #include #include #include -#include -#include #include #include -#include #include #include +#include +#include + #include #include +#include + +#include #include -#include -#include +#include #include "applets.h" #include "timeanddate.h" @@ -39,6 +41,7 @@ #include #include #include +#include /* --- local types and constants --- */ @@ -402,23 +405,48 @@ gboolean refresh_time() { + static char str[256]; + struct pollfd pfd[1]; + gboolean ret = FALSE; + Display *dpy = GDK_DISPLAY(); + Time_Restore(); + memset(str, 0, 256); + + pfd[0].fd = suidinfd; + pfd[0].events = (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI); + while (poll(pfd, 1, 0)) + { + if (fgets (str, 255, suidin)) + { + if (strstr(str, "")) + gpe_popup_infoprint (dpy, + _("Time adjusted from network.")); + else + gpe_error_box(_("Adjusting time from network failed.")); + + } + ret = TRUE; + } + trc--; - if (!trc) + if (!trc) + ret = TRUE; + if (ret) { - gtk_widget_set_sensitive(self.internet,TRUE); - gtk_timeout_remove(tid); + gtk_widget_set_sensitive(self.internet, TRUE); + return FALSE; } system (SCREENSAVER_RESET_CMD); - return (trc ? TRUE : FALSE); + return (TRUE); } void GetInternetTime() { gtk_widget_set_sensitive(self.internet,FALSE); suid_exec("NTPD",gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (self.ntpserver)->entry))); - trc = 10; - tid = gtk_timeout_add(500,refresh_time,NULL); + trc = 60; + tid = gtk_timeout_add(500, refresh_time, NULL); }