summaryrefslogtreecommitdiff
path: root/nacl/curvecp/open_lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/curvecp/open_lock.c')
-rw-r--r--nacl/curvecp/open_lock.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/nacl/curvecp/open_lock.c b/nacl/curvecp/open_lock.c
deleted file mode 100644
index 898f3b60..00000000
--- a/nacl/curvecp/open_lock.c
+++ /dev/null
@@ -1,19 +0,0 @@
1#include <sys/types.h>
2#include <sys/stat.h>
3#include <unistd.h>
4#include <fcntl.h>
5#include "open.h"
6
7int open_lock(const char *fn)
8{
9#ifdef O_CLOEXEC
10 int fd = open(fn,O_RDWR | O_CLOEXEC);
11 if (fd == -1) return -1;
12#else
13 int fd = open(fn,O_RDWR);
14 if (fd == -1) return -1;
15 fcntl(fd,F_SETFD,1);
16#endif
17 if (lockf(fd,F_LOCK,0) == -1) { close(fd); return -1; }
18 return fd;
19}