[OpenAFS-devel] extraneous macro tests

Matthew Andrews matt@slackers.net
Tue, 18 Jun 2002 04:07:50 -0700


I noticed that in afs_vnop_write.c: afs_write()
there is a macro definition test that couldn't possibly be true.

lines 827-840:
#if defined(AFS_SGI_ENV)
    if (!lastclose) {
    afs_PutFakeStat(&fakestat);
     return 0;
    }
#else
#if    defined(AFS_SUN_ENV) || defined(AFS_SGI_ENV)
    if (count > 1) {
    /* The vfs layer may call this repeatedly with higher "count"; only 
on the last close (i.e. count = 1) we should actually proceed with the 
close. */
    afs_PutFakeStat(&fakestat);
    return 0;
    }
#endif
#endif

in the second #if, it makes no sense to test whether AFS_SGI_ENV is 
defined, since that entire test will only ever be done if AFS_SGI_ENV is 
not defined. this isn't exactly a bug, but it is rather confusing. 
should we be fixing such things as we notice them? If so, I'll send a 
note about this to openafs-bugs.

-Matthew Andrews