aboutsummaryrefslogtreecommitdiffstats
path: root/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch')
-rw-r--r--packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch148
1 files changed, 148 insertions, 0 deletions
diff --git a/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch b/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch
index e69de29bb2..2a9b3098ff 100644
--- a/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch
+++ b/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch
@@ -0,0 +1,148 @@
+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,"<failed>\n");
+ }
+- else // if ok, update rtc time
++ else /* if ok, update rtc time */
+ {
++ fprintf(nsreturn,"<success>\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 <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <dirent.h>
+-#include <pwd.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+-#include <signal.h>
+ #include <time.h>
+ #include <libintl.h>
++#include <time.h>
++#include <ctype.h>
++
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#include <sys/poll.h>
++
++#include <X11/Xlib.h>
+ #include <gtk/gtk.h>
+-#include <time.h>
+-#include <ctype.h>
++#include <gdk/gdkx.h>
+
+ #include "applets.h"
+ #include "timeanddate.h"
+@@ -39,6 +41,7 @@
+ #include <gpe/errorbox.h>
+ #include <gpe/gtkdatecombo.h>
+ #include <gpe/gpetimesel.h>
++#include <gpe/infoprint.h>
+
+
+ /* --- 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, "<success>"))
++ 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);
+ }
+
+