[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] writeactive() not updating mtime?
On Fri, Nov 10, 2000 at 10:58:35AM -0600, Mike Castle wrote:
> Instead of opening .overview, open .overview.fetchnews or .overview.leafnode
> and then rename to .overview. No need for lock, unless you want to save
> CPU cycles.
In principle this is already done:
strcpy( newfile, ".overview.XXXXXX" );
#ifdef HAVE_MKSTEMP
if ( (wfd=mkstemp(newfile)) == -1) {
syslog( LOG_ERR, "mkstemp of new .overview failed: %m" );
return;
}
#else
if ( !( wfd=open( mktemp(newfile), O_WRONLY|O_CREAT|O_EXCL, 0664 ) ) ) {
syslog( LOG_ERR,
"open(O_WRONLY|O_CREAT|O_EXCL) of new .overview failed: %m" );
return;
}
#endif
So the corruption Stefan Wiens reported must have happened during
if ( rename( newfile, ".overview" ) ) {
Regards,
Jo:rg
--
Fortune cookie of the day:
Didn't I buy a 1951 Packard from you last March in Cairo?
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list