Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 1995 13:23:09 +0100 (MET)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        bde@zeta.org.au (Bruce Evans)
Cc:        hackers@FreeBSD.org
Subject:   Re: vipw feature (and fix)
Message-ID:  <199503211223.NAA24633@labinfo.iet.unipi.it>
In-Reply-To: <199503211152.VAA14006@godzilla.zeta.org.au> from "Bruce Evans" at Mar 21, 95 09:51:54 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >A better way would be needed for the check. On 2.1 the stat structure
> >actually uses "struct timespec" for the times. I propose to modify line
> >95 of vipw.c from
> 
> >		if (begin.st_mtime == end.st_mtime) {
> 
> >to
> >		if (begin.st_mtimespec == end.st_mtimespec) {
> 
> This wouldn't help if the file system is the current or older ufs.  The
> nanonseconds field is always 0.

Didn't know that. Thanks for pointing it out.
Then I guess we have to checksum the file to see if it has changed!

> The problem could be fixed by adding `sleep(1)' before calling pw_edit()
> (assuming sleep(1) is guaranteed to take >= 1 second).

This is what I do currently, but it is so boring to wait on a fast
machine!

Does anybody know what is the meaning of the st_gen field of the
stat structure ? I thought it was some form of version number (it
would cost almost nothing to increment it every time the file is
written to), but at least on my 1.1.5 system it stays at the same
value forever.

	Luigi
====================================================================
Luigi Rizzo                     Dip. di Ingegneria dell'Informazione
email: luigi@iet.unipi.it       Universita' di Pisa
tel: +39-50-568533              via Diotisalvi 2, 56126 PISA (Italy)
fax: +39-50-568522
====================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503211223.NAA24633>