summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2015-07-17 11:00:44 +0200
committerSalvatore Sanfilippo <antirez@gmail.com>2015-07-17 11:00:44 +0200
commitbcb4d091233a98b025aac18b3a7e4966356323eb (patch)
tree3b95530375ebb35d5fa3453404fa345e19b0f7b4
parent29391002f6825d972718225354b24059a11531cd (diff)
parentc7462ca9ffd8ccafee2605bd5c69e6a5bc5b240a (diff)
downloadredis-bcb4d091233a98b025aac18b3a7e4966356323eb.tar.gz
Merge pull request #2636 from badboy/cluster-lock-fix
Cluster lock fix
-rw-r--r--src/cluster.c7
-rw-r--r--src/redis.c1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/cluster.c b/src/cluster.c
index fb45bd063..6280677ae 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -358,6 +358,11 @@ void clusterSaveConfigOrDie(int do_fsync) {
* On success REDIS_OK is returned, otherwise an error is logged and
* the function returns REDIS_ERR to signal a lock was not acquired. */
int clusterLockConfig(char *filename) {
+/* flock() does not exist on Solaris
+ * and a fcntl-based solution won't help, as we constantly re-open that file,
+ * which will release _all_ locks anyway
+ */
+#if !defined(__sun)
/* To lock it, we need to open the file in a way it is created if
* it does not exist, otherwise there is a race condition with other
* processes. */
@@ -385,6 +390,8 @@ int clusterLockConfig(char *filename) {
}
/* Lock acquired: leak the 'fd' by not closing it, so that we'll retain the
* lock to the file as long as the process exists. */
+#endif /* __sun */
+
return REDIS_OK;
}
diff --git a/src/redis.c b/src/redis.c
index 2a6bb47bb..b5ade925e 100644
--- a/src/redis.c
+++ b/src/redis.c
@@ -53,7 +53,6 @@
#include <sys/resource.h>
#include <sys/utsname.h>
#include <locale.h>
-#include <sys/sysctl.h>
#include <sys/socket.h>
/* Our shared "common" objects */