From 6aab4cb73662578174a14dc846fdc64e1dd71eb2 Mon Sep 17 00:00:00 2001 From: Steffen Moser Date: Tue, 27 Sep 2022 15:20:13 +0200 Subject: [PATCH] Fixing compilation by removing flock() when compiling on Solaris (#11327) SunOS/Solaris and its relatives don't support the flock() function. While "redis" has been excluding setting up the lock using flock() on the cluster configuration file when compiling under Solaris, it was still using flock() in the unlock call while shutting down. This pull request eliminates the flock() call also in the unlocking stage for Oracle Solaris and its relatives. Fix compilation regression from #10912 --- src/server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server.c b/src/server.c index a1f8eca78..d5b3ea690 100644 --- a/src/server.c +++ b/src/server.c @@ -4248,10 +4248,13 @@ int finishShutdown(void) { /* Close the listening sockets. Apparently this allows faster restarts. */ closeListeningSockets(1); +#if !defined(__sun) /* Unlock the cluster config file before shutdown */ if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1) { flock(server.cluster_config_file_lock_fd, LOCK_UN|LOCK_NB); } +#endif /* __sun */ + serverLog(LL_WARNING,"%s is now ready to exit, bye bye...", server.sentinel_mode ? "Sentinel" : "Redis");