Subject: Re: nsswitch implementation questions...
To: None <current-users@NetBSD.ORG>
From: Steve Singles <steve@kiera.wizards.raptor.com>
List: current-users
Date: 01/17/1996 18:49:48
Luke Mewburn <lukem@telstra.com.au> has written:
>
> 	static time_t lastmod;
> 	struct stat sb; 
> 	if (lastmod) {
> 		if (fstat(fd, &sb) == -1)
> 			return;
> 		if (lastmod <= sb.st_mtime) {
> 			(dp->close)(dp);		/* point 1 */
> 			lastmod = 0;
> 		}
> 	}

    Rather than fstat'ing the open fd, you should stat the file
and check the inode# as well as st_mtime.  This fixes the case
of an old nsswitch file replacing a newer one.

Steve