Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2002 16:08:04 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Jens Schweikhardt <schweikh@schweikhardt.net>, freebsd-audit@FreeBSD.ORG
Cc:        joerg@FreeBSD.ORG
Subject:   Re: crontab changes for PR bin/22612; please comment
Message-ID:  <p05101502b8bc01b04024@[128.113.24.47]>
In-Reply-To: <20020318130904.A3869@schweikhardt.net>
References:  <20020318130904.A3869@schweikhardt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
At 1:09 PM +0100 3/18/02, Jens Schweikhardt wrote:
>hello, world\n
>
>please comment on this patch (slightly different from the
>one in the PR
>http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/22612)
>
>Currently, checking for modification of the tmp file just
>looks at the mtime and gives a false "no modification" if
>the edit took less than 1 second. This is solved by simply
>comparing the whole struct stat.

I don't think you should blindly compare the entire struct.
You don't know what fields are in there, so you don't know
if some field has changed even though the contents of the
file has not changed.  If you do try this, you should at
least zero out the entire struct-stat before each call to
stat(), just in case there are unused fields in the record.

Just MO.

Stupid brain-dead alternative fix:
   Create the file.  stat the file.  sleep a second.
   *Then* open the file in the user's editor.  Any
   change that they make will have to have been done
   more than a second later.

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




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