apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 flock.c
Date Sat, 05 Jan 2002 08:02:39 GMT
wrowe       02/01/05 00:02:39

  Modified:    file_io/win32 flock.c
  Log:
    Tighter localization of some variables... found experimenting in other
    bits of the server [looking at shmem locks a while back.]
  
  Revision  Changes    Path
  1.8       +6 -6      apr/file_io/win32/flock.c
  
  Index: flock.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/flock.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- flock.c	28 Dec 2001 23:50:48 -0000	1.7
  +++ flock.c	5 Jan 2002 08:02:39 -0000	1.8
  @@ -56,13 +56,12 @@
   
   APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type)
   {
  -    OVERLAPPED offset;
  -    DWORD flags, len = 0xffffffff;
  +    const DWORD len = 0xffffffff;
  +    DWORD flags; 
   
       flags = ((type & APR_FLOCK_NONBLOCK) ? LOCKFILE_FAIL_IMMEDIATELY : 0)
             + (((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED) 
                                          ? 0 : LOCKFILE_EXCLUSIVE_LOCK);
  -    memset (&offset, 0, sizeof(offset));
       /* XXX on NT 4.0 we get ERROR_LOCK_VIOLATION when we specify
        *     LOCKFILE_FAIL_IMMEDIATELY and another process is holding
        *     the lock; something needs to be done so an APR app can
  @@ -70,6 +69,8 @@
        */
       if (apr_os_level >= APR_WIN_NT) {
           /* Syntax is correct, len is passed for LengthLow and LengthHigh*/
  +        OVERLAPPED offset;
  +        memset (&offset, 0, sizeof(offset));
           if (!LockFileEx(thefile->filehand, flags, 0, len, len, &offset))
               return apr_get_os_error();
       }
  @@ -83,13 +84,12 @@
   
   APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile)
   {
  -    OVERLAPPED offset;
       DWORD len = 0xffffffff;
   
  -    memset (&offset, 0, sizeof(offset));
  -
       if (apr_os_level >= APR_WIN_NT) {
           /* Syntax is correct, len is passed for LengthLow and LengthHigh*/
  +        OVERLAPPED offset;
  +        memset (&offset, 0, sizeof(offset));
           if (!UnlockFileEx(thefile->filehand, 0, len, len, &offset))
               return apr_get_os_error();
       }
  
  
  

Mime
View raw message