Skip to content

Commit

Permalink
fix OpenSolaris file locking
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto@opensolaris committed Dec 28, 2009
1 parent eeb299d commit ce65601
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spooler.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ce65601

Please sign in to comment.