From 978e33ba253a997b41b331b449b474a5cee7bccc Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 23 Jan 2012 08:54:31 +0100 Subject: Imported Upstream version 2.1.10 --- src/options.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/options.cpp') 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 +#ifndef ZMQ_HAVE_WINDOWS +#include +#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; -- cgit v1.2.3