From e2967396ac73cb7410787886cdaf072a184ffc49 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 2 Jul 2013 09:53:34 -0400 Subject: Added NaCl crypto library. --- nacl/curvecp/open_write.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 nacl/curvecp/open_write.c (limited to 'nacl/curvecp/open_write.c') diff --git a/nacl/curvecp/open_write.c b/nacl/curvecp/open_write.c new file mode 100644 index 00000000..e23752d1 --- /dev/null +++ b/nacl/curvecp/open_write.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include +#include "open.h" + +int open_write(const char *fn) +{ +#ifdef O_CLOEXEC + return open(fn,O_CREAT | O_WRONLY | O_NONBLOCK | O_CLOEXEC,0644); +#else + int fd = open(fn,O_CREAT | O_WRONLY | O_NONBLOCK,0644); + if (fd == -1) return -1; + fcntl(fd,F_SETFD,1); + return fd; +#endif +} -- cgit v1.2.3