Commit 204bc4f6 authored by rswindell's avatar rswindell
Browse files

ftouch() optimization (don't check for file existence)

parent f03c720a
......@@ -66,6 +66,7 @@ int nopen(const char* str, int access)
mswait(100);
return(file);
}
/****************************************************************************/
/* This function performs an nopen, but returns a file stream with a buffer */
/* allocated. */
......@@ -111,13 +112,15 @@ BOOL ftouch(const char* fname)
{
int file;
if(!fexist(fname)) { /* create the file */
if((file=nopen(fname,O_WRONLY|O_CREAT))<0)
return(FALSE);
close(file);
}
/* update the time stamp */
return utime(fname,NULL)==0;
if(utime(fname, /* use current date/time: */NULL)==0)
return(TRUE);
/* create the file */
if((file=nopen(fname,O_WRONLY|O_CREAT))<0)
return(FALSE);
close(file);
return(TRUE);
}
BOOL fmutex(const char* fname, const char* text, long max_age)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment