Bug 465

Summary: Fix for build failure on GNU/Hurd
Product: Sudo Reporter: Bdale Garbee <bdale>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.7.4   
Hardware: PC   
OS: Linux   

Description Bdale Garbee 2011-02-09 13:36:35 MST
Svante Signell provided the following fix for build failures in the Debian Hurd project.  I've folded this in to my Debian package builds for now, would be great if you can include this in a future release of sudo.

Bdale



When building from source on GNU/Hurd the macro HAVE_GETUTID is defined
but not on GNU/Linux, making the Hurd build fail. The problem is that
<utmp.h> is included after the include of "compat.h" when HAVE_GETUTID
is defined. Moving the include higher up solves this problem, see the
inlined patch. 

cat fix_sudo_hurd_source_build.diff
--- boottime.c.orig     2011-01-27 19:10:11.000000000 +0100
+++ boottime.c  2011-01-27 19:11:49.000000000 +0100
@@ -47,6 +47,14 @@
 # include <sys/sysctl.h>
 #endif
 
+/* Must be included above "compat.h"!!  */
+#if defined(HAVE_GETUTXID)
+#include <utmpx.h>
+#elif defined(HAVE_GETUTID)
+#include <utmp.h>
+#else
+#endif
+
 #include "compat.h"
 #include "missing.h"
 
@@ -102,7 +110,6 @@
 
 #elif defined(HAVE_GETUTXID)
 
-#include <utmpx.h>
 int
 get_boottime(tv)
     struct timeval *tv;
@@ -121,7 +128,6 @@
 
 #elif defined(HAVE_GETUTID)
 
-#include <utmp.h>
 int
 get_boottime(tv)
     struct timeval *tv;
Comment 1 Todd C. Miller 2011-02-09 15:12:24 MST
Thanks, this will be fixed in sudo 1.7.5.
Comment 2 Todd C. Miller 2011-03-03 09:51:50 MST
Fixed in sudo 1.7.5 and 1.8.0.