diff options
Diffstat (limited to 'src/options.cpp')
-rw-r--r-- | src/options.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/options.cpp b/src/options.cpp index 92887ab..952907b 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -19,9 +19,11 @@ */ #include <string.h> +#ifndef ZMQ_HAVE_WINDOWS +#include <sys/stat.h> +#endif #include "../include/zmq.h" - #include "options.hpp" #include "err.hpp" @@ -64,6 +66,12 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, errno = EINVAL; return -1; } + // Check that SWAP directory (.) is writable + struct stat stat_buf; + if (stat (".", &stat_buf) || ((stat_buf.st_mode & S_IWRITE) == 0)) { + errno = EACCES; + return -1; + } swap = *((int64_t*) optval_); return 0; |