Changeset 2696

Show
Ignore:
Timestamp:
03/01/08 02:20:42 (9 months ago)
Author:
dhozac
Message:

lockf(F_LOCK) requests a write lock, which requires the file to be open in write mode.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/lockfile.c

    r2678 r2696  
    111111  if ((sync_fd=open(argv[idx+1], O_WRONLY))==-1) 
    112112    perror("lockfile: open(<syncpipe>)"); 
    113   else if ((fd=open(argv[idx], O_CREAT|O_RDONLY|O_NOFOLLOW|O_NONBLOCK, 0644))==-1) 
     113  else if ((fd=open(argv[idx], O_CREAT|O_WRONLY|O_NOFOLLOW|O_NONBLOCK, 0644))==-1) 
    114114    perror("lockfile: open(<lockfile>)"); 
    115115  else if (unlink(argv[idx+1])==-1) 
     
    123123    int         duration = end_time-time(0); 
    124124    alarm(MIN(10, MAX(duration,1))); 
    125      
     125 
    126126    if (lockf(fd,F_LOCK,0)==-1) { 
    127127      if (errno==EINTR) continue;