summaryrefslogtreecommitdiff
path: root/src/options.cpp
diff options
context:
space:
mode:
authorMartin Lucina <martin@lucina.net>2012-01-23 08:54:31 +0100
committerMartin Lucina <martin@lucina.net>2012-01-23 08:54:31 +0100
commit978e33ba253a997b41b331b449b474a5cee7bccc (patch)
tree68b0709e1ebb04bf7fd102a7783e3f93dd52cc8c /src/options.cpp
parent75af6aed482ab16997c1388fe801f74d11ec12a4 (diff)
Imported Upstream version 2.1.10upstream/2.1.10
Diffstat (limited to 'src/options.cpp')
-rw-r--r--src/options.cpp10
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;