Should this work? I've tried a couple of patches I've seen
posted here by HJ Lu but none of them solved this.
Craig
--------------------- lock.c ---------------------------------------
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
int main (void)
{
int fd;
struct flock l;
l.l_type = F_WRLCK;
l.l_whence = SEEK_SET;
l.l_start = 0;
l.l_len = 0;
if ((fd = open ("tmp.tmp", O_WRONLY)) < 0) {
printf ("Error opening file\n");
exit (1);
}
if (fcntl (fd, F_SETLK, &l) < 0) {
perror ("Lock error");
} else {
printf ("File locked\n");
sleep (5);
}
exit (0);
}
------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/