I started looking into it because it uses clearenv(3), a GNU extension.
Patch amended to use a portable* replacement instead of... nothing, which
is bad.

* http://marc.info/?l=openbsd-tech&m=146161290611458&w=2

While here:
- tidy up and reorder Makefile
- honor CXXFLAGS
- use the standard way to pass options to ld(1)

Tests would be welcome, looks like I'm too dumb to make it work...

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/incron/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile    23 Jan 2016 16:06:05 -0000      1.1.1.1
+++ Makefile    27 Apr 2016 09:11:39 -0000
@@ -1,21 +1,30 @@
 # $OpenBSD: Makefile,v 1.1.1.1 2016/01/23 16:06:05 landry Exp $
 
 COMMENT =      cron-like daemon but reacting to filesystem events
+
 DISTNAME =     incron-0.5.10
+REVISION =     0
+
 CATEGORIES =   sysutils
+
 HOMEPAGE =     http://inotify.aiken.cz/
+
 MASTER_SITES = http://inotify.aiken.cz/download/incron/
 
 # GPLv2
 PERMIT_PACKAGE_CDROM = Yes
 
-USE_GMAKE =    Yes
-MAKE_FLAGS =   CXXFLAGS="-I${LOCALBASE}/include 
-I${LOCALBASE}/include/inotify" \
-               LDFLAGS="-L${LOCALBASE}/lib/inotify -linotify -Wl,-rpath 
${LOCALBASE}/lib/inotify"
+WANTLIB +=     lib/inotify/inotify c m pthread stdc++
 
-LIB_DEPENDS =  devel/libinotify
 BUILD_DEPENDS =        devel/argp-standalone
-WANTLIB +=     lib/inotify/inotify c m pthread stdc++
+LIB_DEPENDS =  devel/libinotify
+
+MAKE_FLAGS =   CPPFLAGS="-I${LOCALBASE}/include 
-I${LOCALBASE}/include/inotify" \
+               CXXFLAGS="${CXXFLAGS}" \
+               LDFLAGS="-L${LOCALBASE}/lib/inotify -linotify 
-Wl,-rpath,${LOCALBASE}/lib/inotify"
+
+USE_GMAKE =    Yes
+
 NO_TEST =      Yes
 
 .include <bsd.port.mk>
Index: patches/patch-usertable_cpp
===================================================================
RCS file: /cvs/ports/sysutils/incron/patches/patch-usertable_cpp,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-usertable_cpp
--- patches/patch-usertable_cpp 23 Jan 2016 16:06:05 -0000      1.1.1.1
+++ patches/patch-usertable_cpp 27 Apr 2016 09:15:27 -0000
@@ -1,12 +1,17 @@
 $OpenBSD: patch-usertable_cpp,v 1.1.1.1 2016/01/23 16:06:05 landry Exp $
---- usertable.cpp.orig Wed Nov 26 21:47:55 2014
-+++ usertable.cpp      Wed Nov 26 21:48:03 2014
-@@ -545,8 +545,6 @@ void UserTable::RunAsUser(char* const* argv) const
+
+- clearenv(3) is a GNU extension
+
+--- usertable.cpp.orig Sat Apr  7 00:19:27 2012
++++ usertable.cpp      Wed Apr 27 11:01:00 2016
+@@ -545,8 +545,8 @@ void UserTable::RunAsUser(char* const* argv) const
    }
  
    if (pwd->pw_uid != 0) {
 -    if (clearenv() != 0)
 -      goto failed;
++    extern char **environ;
++    environ = (char **)calloc(1, sizeof(*environ));
  
      if (    setenv("LOGNAME",   pwd->pw_name,   1) != 0
          ||  setenv("USER",      pwd->pw_name,   1) != 0


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to