aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-08-24 17:35:53 -0400
committerJoey Hess <joey@kitenet.net>2011-08-24 17:35:53 -0400
commitc8f7dcbc3107fb4cc0b60958d5b10f4ea154054d (patch)
tree69e2a54519bea480f8392fc0e91ce22fe0dfc27e
parentbb1f713f8d54ea8d2cf877a4c275674b8236c9d5 (diff)
downloadikiwiki-c8f7dcbc3107fb4cc0b60958d5b10f4ea154054d.tar
ikiwiki-c8f7dcbc3107fb4cc0b60958d5b10f4ea154054d.tar.gz
Use lockf rather than flock when taking the cgilock, for better portability.
This kind of change is scary, but this particular lock is very simply used and so it seems ok to make it even just for better portability to SunOS. (People still use that?)
-rw-r--r--IkiWiki/Wrapper.pm2
-rw-r--r--debian/changelog2
-rw-r--r--doc/bugs/ikiwiki_cgi_fails_to_build_on_Solaris_due_to_missing_LOCK__95__EX.mdwn14
3 files changed, 16 insertions, 2 deletions
diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm
index d39a3ea40..c39aa2ef7 100644
--- a/IkiWiki/Wrapper.pm
+++ b/IkiWiki/Wrapper.pm
@@ -95,7 +95,7 @@ EOF
# IKIWIKI_CGILOCK_FD so unlockwiki can close it.
$pre_exec=<<"EOF";
lockfd=open("$config{wikistatedir}/cgilock", O_CREAT | O_RDWR, 0666);
- if (lockfd != -1 && flock(lockfd, LOCK_EX) == 0) {
+ if (lockfd != -1 && lockf(lockfd, F_LOCK, 0) == 0) {
char *fd_s=malloc(8);
sprintf(fd_s, "%i", lockfd);
setenv("IKIWIKI_CGILOCK_FD", fd_s, 1);
diff --git a/debian/changelog b/debian/changelog
index 5ac821b18..cd0b3a114 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,8 @@ ikiwiki (3.20110716) UNRELEASED; urgency=low
before Image::Magick.
* Add unminified jquery js and css files to source.
* Update to jquery 1.6.2, and jquery-ui 1.8.14.
+ * Use lockf rather than flock when taking the cgilock, for better
+ portability.
-- Joey Hess <joeyh@debian.org> Tue, 19 Jul 2011 11:22:52 -0400
diff --git a/doc/bugs/ikiwiki_cgi_fails_to_build_on_Solaris_due_to_missing_LOCK__95__EX.mdwn b/doc/bugs/ikiwiki_cgi_fails_to_build_on_Solaris_due_to_missing_LOCK__95__EX.mdwn
index 2913bfb53..aca1ef106 100644
--- a/doc/bugs/ikiwiki_cgi_fails_to_build_on_Solaris_due_to_missing_LOCK__95__EX.mdwn
+++ b/doc/bugs/ikiwiki_cgi_fails_to_build_on_Solaris_due_to_missing_LOCK__95__EX.mdwn
@@ -28,4 +28,16 @@ to read
if (lockfd != -1 && lockf(lockfd, F_LOCK,0) == 0) {
-in IkiWiki/Wrapper.pm lets it compile, according to http://man-wiki.net/index.php/3:lockf "On Linux, this call is just an interface for fcntl(2)" does this seem like a sensible fix?
+in IkiWiki/Wrapper.pm lets it compile, according to
+http://man-wiki.net/index.php/3:lockf "On Linux, this call is just an
+interface for fcntl(2)" does this seem like a sensible fix?a
+
+> Don't see why not. flock was used only because it's being used
+> in the same file for testing some other locks.
+>
+> While lockf's fcntl locks are not inherited across a fork,
+> that doesn't matter for this lock, which is only used to
+> prevent more than one ikiwiki perl process being run at a time.
+> Nor is there any need to be compatible with some other user of this
+> lock; it's only checked in one place. [[applied|done]]
+> --[[Joey]]