The fix for Bug 3664 "ssl_crtd fails to build on OpenSolaris/OpenIndiana/Solaris 11"
introduced a regression on BSD and Linux where lockf() implementations appear not to
lock the entire file correctly or as reliably as flock().
Reverting the flock/lockf change for non-Solaris OS.
#if _SQUID_WINDOWS_
if (!LockFile(hFile, 0, 0, 1, 0))
-#else
+#elif _SQUID_SOLARIS_
if (lockf(fd, F_LOCK, 0) != 0)
+#else
+ if (flock(fd, LOCK_EX) != 0)
#endif
throw std::runtime_error("Failed to get a lock of " + filename);
}
}
#else
if (fd != -1) {
+#if _SQUID_SOLARIS_
lockf(fd, F_ULOCK, 0);
+#else
+ flock(fd, LOCK_UN);
+#endif
close(fd);
fd = -1;
}