aboutsummaryrefslogtreecommitdiffstats
path: root/security/courier-authlib/files/patch-liblock__locktest.c
diff options
context:
space:
mode:
authorAdam Weinberger <adamw@FreeBSD.org>2014-07-29 17:12:47 +0000
committerAdam Weinberger <adamw@FreeBSD.org>2014-07-29 17:12:47 +0000
commit08a006d08a4c35d2c3ecc9a3d10cf7fd14661a84 (patch)
tree0cfc4f0736babb895eb97a65c6defe632a0249c7 /security/courier-authlib/files/patch-liblock__locktest.c
parentf474a16cfbfad1844b9c50e45e36a3a77f0c59b5 (diff)
Rename all patches that contain '::' as a path separator, and use
'__' instead.
Diffstat (limited to 'security/courier-authlib/files/patch-liblock__locktest.c')
-rw-r--r--security/courier-authlib/files/patch-liblock__locktest.c81
1 files changed, 81 insertions, 0 deletions
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..3f77f4b30a26
--- /dev/null
+++ b/security/courier-authlib/files/patch-liblock__locktest.c
@@ -0,0 +1,81 @@
+--- libs/liblock/locktest.c.orig Mon Dec 6 14:18:55 1999
++++ libs/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]);