Skip to content

Instantly share code, notes, and snippets.

@klobs
Created November 13, 2011 04:21
Show Gist options
  • Save klobs/1361591 to your computer and use it in GitHub Desktop.
Save klobs/1361591 to your computer and use it in GitHub Desktop.
Patch to make apt-dater work under Mac OS X
diff --git a/src/Makefile.am b/src/Makefile.am
index 8eafc8f..13cd597 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,6 +37,6 @@ apt_dater_SOURCES = \
apt_dater_LDADD = $(GLIB_LIBS) $(TCL_LIBS) $(LIBXML2_LIBS)
AM_CFLAGS = -Wall -DPKGLIBDIR='"'$(pkglibdir)'"'
-AM_LDFLAGS = -Wl,--as-needed
+AM_LDFLAGS = -Wl
INCLUDES = $(GLIB_CFLAGS) $(TCL_CFLAGS) $(LIBXML2_CFLAGS)
diff --git a/src/Makefile.in b/src/Makefile.in
index d5e3f8b..6ace5f2 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -228,7 +228,7 @@ apt_dater_SOURCES = \
apt_dater_LDADD = $(GLIB_LIBS) $(TCL_LIBS) $(LIBXML2_LIBS)
AM_CFLAGS = -Wall -DPKGLIBDIR='"'$(pkglibdir)'"'
-AM_LDFLAGS = -Wl,--as-needed
+AM_LDFLAGS = -Wl
INCLUDES = $(GLIB_CFLAGS) $(TCL_CFLAGS) $(LIBXML2_CFLAGS)
all: all-am
diff --git a/src/apt-dater.c b/src/apt-dater.c
index 49d3138..890530d 100644
--- a/src/apt-dater.c
+++ b/src/apt-dater.c
@@ -180,10 +180,10 @@ int main(int argc, char **argv, char **envp)
if(!report) {
#endif
/* Test if we are the owner of the TTY or die. */
- if(g_access("/proc/self/fd/0", R_OK|W_OK)) {
- g_error(_("Cannot open your terminal /proc/self/fd/0 - please check."));
- exit(EXIT_FAILURE);
- }
+// if( g_access("/proc/self/fd/0", R_OK|W_OK)) {
+// g_error(_("Cannot open your terminal /proc/self/fd/0 - please check."));
+// exit(EXIT_FAILURE);
+// }
getOldestMtime(hosts);
diff --git a/src/stats.c b/src/stats.c
index 4e62a70..aa45fc1 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -96,6 +96,9 @@ gboolean setStatsFileFromIOC(GIOChannel *ioc, GIOCondition condition,
if(iostatus == G_IO_STATUS_ERROR || iostatus == G_IO_STATUS_AGAIN)
break;
+ if(*buf == 0)
+ condition = G_IO_HUP;
+
if(fwrite(buf, sizeof(gchar), bytes, ((HostNode *) n)->fpstat) != bytes)
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment