diff options
author | Oliver Lehmann <oliver@FreeBSD.org> | 2005-05-17 18:25:57 +0000 |
---|---|---|
committer | Oliver Lehmann <oliver@FreeBSD.org> | 2005-05-17 18:25:57 +0000 |
commit | 86d570219d0b82b350627c75b61e0bcba74955fc (patch) | |
tree | 4baa9868074b098564a0aa91bf8753e087ee98d8 /security | |
parent | Add man page. (diff) |
use mkstemp(3) in locktest.c instead of executing mktemp(1) in Makefile
Notes
Notes:
svn path=/head/; revision=135507
Diffstat (limited to 'security')
-rw-r--r-- | security/courier-authlib/Makefile | 11 | ||||
-rw-r--r-- | security/courier-authlib/files/patch-liblock::locktest.c | 81 |
2 files changed, 81 insertions, 11 deletions
diff --git a/security/courier-authlib/Makefile b/security/courier-authlib/Makefile index 23df7e9f46ed..d78c74fffaee 100644 --- a/security/courier-authlib/Makefile +++ b/security/courier-authlib/Makefile @@ -173,8 +173,6 @@ USE_RC_SUBR= courier-authdaemond.sh .endif .endif -LOCKTEST!= ${MKTEMP} /tmp/courier-authlib.locktest.XXXXX - post-patch: @${REINPLACE_CMD} -e 's|$$VPOPMAILLIBS|& -lcrypt|g' \ -e 's|^\(INSTALL_STRIP_PROGRAM=\).*$$|\1"$${INSTALL_PROGRAM} -s"|' \ @@ -192,21 +190,12 @@ post-patch: ${WRKSRC}/authdaemonrc.in @${REINPLACE_CMD} -e 's:@EXPECT@:${SETENV} expect:' \ ${WRKSRC}/authsystem.passwd.in - @${REINPLACE_CMD} -e 's|conftest.lock|${LOCKTEST}|g ; \ - s|close(f);|& unlink("${LOCKTEST}");|g ; \ - s|if (s == 0)|unlink("${LOCKTEST}"); &|g' \ - ${WRKSRC}/liblock/locktest.c pre-configure: @if [ -f "${WRKDIR}/courier-authlib.cache" -a -s "${WRKDIR}/courier-authlib.cache" ] ; then \ ${RM} -f "${WRKDIR}/courier-authlib.cache" ; \ fi -post-configure: - @if [ -f "${LOCKTEST}" ] ; then \ - ${RM} -f "${LOCKTEST}" ; \ - fi - .if ${PKGNAMESUFFIX} == "-base" pre-install: @PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL diff --git a/security/courier-authlib/files/patch-liblock::locktest.c b/security/courier-authlib/files/patch-liblock::locktest.c new file mode 100644 index 000000000000..248c25ab5e36 --- /dev/null +++ b/security/courier-authlib/files/patch-liblock::locktest.c @@ -0,0 +1,81 @@ +--- liblock/locktest.c.orig Mon Dec 6 14:18:55 1999 ++++ liblock/locktest.c Sun May 15 08:00:42 2005 +@@ -5,6 +5,7 @@ + + /* $Id */ + ++#include <paths.h> + #include "liblock.h" + #if USE_FCNTL + #include "lockfcntl.c" +@@ -20,11 +21,23 @@ + + int main() + { ++#define FILENAME "courier-authlib.locktest.XXXXX" + int fd[2]; + pid_t p; + int s; + int f; + ++ char *name; ++ const char *tmpdir; ++ if ((tmpdir = (char *)getenv("TMPDIR")) == NULL) ++ tmpdir = _PATH_TMP; ++ (void)asprintf(&name, "%s%s%s", tmpdir, ++ (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", FILENAME); ++ if (name == NULL) { ++ perror("get filename"); ++ exit(1); ++ } ++ + signal(SIGCHLD, SIG_DFL); + if (pipe(fd)) + { +@@ -32,6 +45,12 @@ + return (1); + } + ++ if ((f=mkstemp(name)) < 0) ++ { ++ perror("open"); ++ exit(1); ++ } ++ + if ((p=fork()) == (pid_t)-1) + { + perror("fork"); +@@ -46,7 +65,7 @@ + read(fd[0], &c, 1); + close(fd[0]); + +- if ((f=open("conftest.lock", O_RDWR|O_CREAT, 0644)) < 0) ++ if ((f=open(name, O_RDWR)) < 0) + { + perror("open"); + exit(1); +@@ -56,22 +75,18 @@ + if (ll_lockfd(f, ll_writelock, 0, 0)) + { + close(f); ++ unlink(name); + exit(0); + } + close(f); + exit(1); + } +- +- if ((f=open("conftest.lock", O_RDWR|O_CREAT, 0644)) < 0) +- { +- perror("open"); +- exit(1); +- } + + if (ll_lockfd(f, ll_writelock, 0, 0)) + { + perror("lock"); + close(f); ++ unlink(name); + exit(1); + } + close(fd[1]); |