VLockFile: init fd to INVALID_FD, not zero
authorAndrew Deason <adeason@sinenomine.net>
Thu, 18 Feb 2010 20:41:24 +0000 (14:41 -0600)
committerDerrick Brashear <shadow@dementia.org>
Wed, 24 Feb 2010 06:28:45 +0000 (22:28 -0800)
Zero is a valid file descriptor; initialize lockfile fd to INVALID_FD
instead, so we know it's invalid.

Change-Id: Iacb549ec4ed821763d20cb0e4f25882b4151bf3a
Reviewed-on: http://gerrit.openafs.org/1345
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/vol/vutil.c

index 8b28f9c..8f7aefe 100644 (file)
@@ -850,8 +850,9 @@ void
 VLockFileInit(struct VLockFile *lf, const char *path)
 {
     memset(lf, 0, sizeof(*lf));
-    assert(pthread_mutex_init(&lf->mutex, NULL) == 0);
     lf->path = strdup(path);
+    lf->fd = INVALID_FD;
+    assert(pthread_mutex_init(&lf->mutex, NULL) == 0);
 }
 
 # ifdef AFS_NT40_ENV