From ce656016eb99206d0dc5e5af18100b2baff56d26 Mon Sep 17 00:00:00 2001 From: "roberto@opensolaris" Date: Mon, 28 Dec 2009 11:50:51 +0100 Subject: [PATCH] fix OpenSolaris file locking --- spooler.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spooler.c b/spooler.c index 5070ed8c..84f9d327 100644 --- a/spooler.c +++ b/spooler.c @@ -38,8 +38,13 @@ int spool_request(char *filename, int rn, char *buffer, int size) { return 0 ; } +#ifdef __sun__ + if (lockf(fd, F_LOCK, 0)) { + perror("lockf()"); +#else if (flock(fd, LOCK_EX)) { perror("flock()"); +#endif close(fd); return 0; } @@ -150,8 +155,13 @@ void spooler(PyObject *uwsgi_module) { continue; } +#ifdef __sun__ + if (lockf(spool_fd, F_LOCK, 0)) { + perror("lockf()"); +#else if (flock(spool_fd, LOCK_EX)) { perror("flock()"); +#endif close(spool_fd); continue; }