From owner-freebsd-hackers Tue Mar 21 04:38:14 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id EAA19042 for hackers-outgoing; Tue, 21 Mar 1995 04:38:14 -0800 Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id EAA18774 for ; Tue, 21 Mar 1995 04:31:13 -0800 Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id NAA24633; Tue, 21 Mar 1995 13:23:09 +0100 From: Luigi Rizzo Message-Id: <199503211223.NAA24633@labinfo.iet.unipi.it> Subject: Re: vipw feature (and fix) To: bde@zeta.org.au (Bruce Evans) Date: Tue, 21 Mar 1995 13:23:09 +0100 (MET) Cc: hackers@FreeBSD.org In-Reply-To: <199503211152.VAA14006@godzilla.zeta.org.au> from "Bruce Evans" at Mar 21, 95 09:51:54 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 1344 Sender: hackers-owner@FreeBSD.org Precedence: bulk > >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 ====================================================================