Use lockf instead of flock, the former works on NFS.
[util-vserver.git] / lib_internal / util-lockfile.c
index b08f5a3..bbfd18c 100644 (file)
@@ -61,8 +61,8 @@ lockfile(int *fd, char const *filename, int op, long timeout,
     alarm(timeout);
   }
 
-  errstr = "flock()";
-  while (flock(*fd, op)==-1) {
+  errstr = "lockf()";
+  while (lockf(*fd, op, 0)==-1) {
     if ((errno!=EINTR && errno!=EINTR) || alarm_flag) goto err;
   }