diff options
author | Martin Lucina <mato@kotelna.sk> | 2011-10-03 17:09:06 +0200 |
---|---|---|
committer | Martin Lucina <martin@lucina.net> | 2012-01-23 08:54:33 +0100 |
commit | c3363afa881b46f3df8a6b72ed15cfbac18f4713 (patch) | |
tree | 832e8075a038b49f81e8a7635344f1647007fd15 /src/options.cpp | |
parent | 88f712b4a31c95caef4f34c4ec65793c392314a6 (diff) | |
parent | 978e33ba253a997b41b331b449b474a5cee7bccc (diff) |
Imported Debian patch 2.1.10-1debian/2.1.10-1
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; |