access(2) vs. st_atime

Arthur David Olson ado at elsie.UUCP
Fri Jan 3 10:05:34 AEST 1986


Housekeeping at the New Year brought this to my attention--the result of a
    ls -lu /usr/spool/uucppublic/.hushlogin
command on our 4.1bsd VAX 11/750:
    -rw-r--r-- 1 uucp          0 Mar  6  1984 /usr/spool/uucppublic/.hushlogin

"What?" I asked myself, knowing that "/bin/login" must deal with the above file
several hundred times a day.  As indeed it does, thusly (as usual, the trade
secret status of the code involved precludes a clearer posting):
	...
	char	qlog[]  =	".hushlogin";
	...
	quietlog = FALSE;
	if (access(qlog, 0) == 0)
		quietlog = TRUE;
	...

Now granted, doing an "stat" call on a file ought not change the access time
of the file (so that doing a "ls" of a directory doesn't make it look as if
you've peeked at every file in the directory).  However...shouldn't an "access"
call on a file change the "last access" time for the file?  Does it do so on
systems other than 4.1bsd?
--
UNIX is an AT&T Bell Laboratories trademark.
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado at seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks



More information about the Comp.unix mailing list