From e4ff7ed4c2be9c17c1fe4709554eafe08dae8dc4 Mon Sep 17 00:00:00 2001 From: Rod Widdowson Date: Fri, 28 Jan 2011 16:49:03 +0000 Subject: [PATCH] Do not compare an FD_t < 0 FD_t is an abstract type. Invalid file decriptors are == INVALID_FD. In most places this module does the right thing. Fix the last stragglers where it is testing as less than zero. Reviewed-on: http://gerrit.openafs.org/3768 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: Derrick Brashear (cherry picked from commit 299e942ae98dfea3a4804c724e5d440715974e0c) Change-Id: I8f676c45794ecf53af65e9b3089c7b2d075089bb Reviewed-on: http://gerrit.openafs.org/3871 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/namei_ops.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index c8f9c8369..7d1a5c14c 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -154,8 +154,6 @@ namei_iwrite(IHandle_t * h, afs_foff_t offset, char *buf, afs_fsize_t size) return nBytes; } - - #ifdef AFS_NT40_ENV /* Inode number format: * low 32 bits - if a regular file or directory, the vnode; else the type. @@ -2927,7 +2925,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) (void)afs_snprintf(oldpath, sizeof oldpath, "%s" OS_DIRSEP "%s", dir_name, infoName); fd = afs_open(oldpath, O_RDWR, 0); - if (fd < 0) { + if (fd == INVALID_FD) { Log("1 namei_ConvertROtoRWvolume: could not open RO info file: %s\n", oldpath); code = -1; @@ -2936,7 +2934,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) t_ih.ih_ino = namei_MakeSpecIno(ih->ih_vid, VI_VOLINFO); namei_HandleToName(&n, &t_ih); fd2 = afs_open(n.n_path, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 0); - if (fd2 < 0) { + if (fd2 == INVALID_FD) { Log("1 namei_ConvertROtoRWvolume: could not create RW info file: %s\n", n.n_path); OS_CLOSE(fd); code = -1; @@ -2958,7 +2956,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) (void)afs_snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name, smallName); fd = afs_open(newpath, O_RDWR, 0); - if (fd < 0) { + if (fd == INVALID_FD) { Log("1 namei_ConvertROtoRWvolume: could not open SmallIndex file: %s\n", newpath); code = -1; goto done; @@ -2977,7 +2975,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId) (void)afs_snprintf(newpath, sizeof newpath, "%s" OS_DIRSEP "%s", dir_name, largeName); fd = afs_open(newpath, O_RDWR, 0); - if (fd < 0) { + if (fd == INVALID_FD) { Log("1 namei_ConvertROtoRWvolume: could not open LargeIndex file: %s\n", newpath); code = -1; goto done; -- 2.39.5