mirror of https://github.com/BOINC/boinc.git
parent
f02c4bf105
commit
1fca493e08
|
@ -155,14 +155,14 @@ int lock_file(char* filename) {
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
// some systems have both!
|
// some systems have both!
|
||||||
|
#ifdef HAVE_FLOCK
|
||||||
|
int lock = open(filename, O_WRONLY|O_CREAT, 0644);
|
||||||
|
retval = flock(lock, LOCK_EX|LOCK_NB);
|
||||||
|
#else
|
||||||
#ifdef HAVE_LOCKF
|
#ifdef HAVE_LOCKF
|
||||||
int lock = open(filename, O_WRONLY|O_CREAT, 0644);
|
int lock = open(filename, O_WRONLY|O_CREAT, 0644);
|
||||||
retval = lockf(lock, F_TLOCK, 1);
|
retval = lockf(lock, F_TLOCK, 1);
|
||||||
// must leave fd open
|
// must leave fd open
|
||||||
#else
|
|
||||||
#ifdef HAVE_FLOCK
|
|
||||||
int lock = open(filename, O_WRONLY|O_CREAT, 0644);
|
|
||||||
retval = flock(lock, LOCK_EX|LOCK_NB);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue