From: Jeffrey Altman Date: Thu, 28 Oct 2010 04:40:32 +0000 (-0400) Subject: vol: Always use INVALID_FD to indicate an invalid fd X-Git-Tag: upstream/1.6.0.pre2^2~26 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=b682683bdd032157626448b504336c174e0809c1;p=packages%2Fo%2Fopenafs.git vol: Always use INVALID_FD to indicate an invalid fd file descriptors on Windows are not ints and therefore cannot be safely compared against -1. Always use INVALID_FD which is -1 on UNIX and INVALID_HANDLE_VALUE on Windows. Reviewed-on: http://gerrit.openafs.org/3178 Reviewed-by: Derrick Brashear Reviewed-by: Andrew Deason Tested-by: Derrick Brashear (cherry picked from commit d21dd16789458c07e63abe021f93f656dba4e52c) Change-Id: I99e0ef2f0c1ff23817ffb13b270bc0f04bcf12a4 Reviewed-on: http://gerrit.openafs.org/3905 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/vol/partition.c b/src/vol/partition.c index a6f9e27ff..d3be1d77c 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -1227,7 +1227,7 @@ VLockPartition_r(char *name) if (!dp) return; /* no partition, will fail later */ - if (dp->lock_fd != -1) + if (dp->lock_fd != INVALID_FD) return; #if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) @@ -1250,7 +1250,7 @@ VLockPartition_r(char *name) else dp->lock_fd = afs_open(partitionName, code); - if (dp->lock_fd != -1) + if (dp->lock_fd != INVALID_FD) break; if (errno == ENOENT) code |= O_CREAT; @@ -1314,7 +1314,7 @@ VUnlockPartition_r(char *name) if (!dp) return; /* no partition, will fail later */ close(dp->lock_fd); - dp->lock_fd = -1; + dp->lock_fd = INVALID_FD; } #endif /* AFS_NT40_ENV */