------------------------------------------------------------ revno: 13219 revision-id: squid3@treenet.co.nz-20150414073615-nvgofeoemrgossxh parent: squid3@treenet.co.nz-20150218110342-0jeaz5896erlx7yf fixes bug: http://bugs.squid-cache.org/show_bug.cgi?id=4212 committer: Amos Jeffries branch nick: 3.4 timestamp: Tue 2015-04-14 00:36:15 -0700 message: Bug 4212: ssl_crtd crashes with corrupt database 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. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150414073615-nvgofeoemrgossxh # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.4 # testament_sha1: 190d0cb3af32a05bd3eeeafc10d96231ad40c8c0 # timestamp: 2015-04-14 07:37:53 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.4 # base_revision_id: squid3@treenet.co.nz-20150218110342-\ # 0jeaz5896erlx7yf # # Begin patch === modified file 'src/ssl/certificate_db.cc' --- src/ssl/certificate_db.cc 2015-01-09 10:27:12 +0000 +++ src/ssl/certificate_db.cc 2015-04-14 07:36:15 +0000 @@ -54,8 +54,10 @@ #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); } @@ -70,7 +72,11 @@ } #else if (fd != -1) { +#if _SQUID_SOLARIS_ lockf(fd, F_ULOCK, 0); +#else + flock(fd, LOCK_UN); +#endif close(fd); fd = -1; }