From: Andrew Evdokimov Date: Fri, 9 Jan 2015 10:27:12 +0000 (-0800) Subject: Bug 3664: ssl_crtd fails to build on OpenSolaris/OpenIndiana/Solaris 11 X-Git-Tag: SQUID_3_4_11~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c36647ae7ab50c82476c638dc1160aee550997e;p=thirdparty%2Fsquid.git Bug 3664: ssl_crtd fails to build on OpenSolaris/OpenIndiana/Solaris 11 --- diff --git a/src/ssl/certificate_db.cc b/src/ssl/certificate_db.cc index 346fd2a406..5d4e6cffd2 100644 --- a/src/ssl/certificate_db.cc +++ b/src/ssl/certificate_db.cc @@ -47,7 +47,7 @@ void Ssl::Lock::lock() hFile = CreateFile(TEXT(filename.c_str()), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) #else - fd = open(filename.c_str(), 0); + fd = open(filename.c_str(), O_RDWR); if (fd == -1) #endif throw std::runtime_error("Failed to open file " + filename); @@ -55,7 +55,7 @@ void Ssl::Lock::lock() #if _SQUID_WINDOWS_ if (!LockFile(hFile, 0, 0, 1, 0)) #else - if (flock(fd, LOCK_EX) != 0) + if (lockf(fd, F_LOCK, 0) != 0) #endif throw std::runtime_error("Failed to get a lock of " + filename); } @@ -70,7 +70,7 @@ void Ssl::Lock::unlock() } #else if (fd != -1) { - flock(fd, LOCK_UN); + lockf(fd, F_ULOCK, 0); close(fd); fd = -1; }