Skip to content
Snippets Groups Projects
Commit 204bc4f6 authored by rswindell's avatar rswindell
Browse files

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

parent f03c720a
No related branches found
No related tags found
No related merge requests found
......@@ -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 */
/* update the time stamp */
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);
}
/* update the time stamp */
return utime(fname,NULL)==0;
return(TRUE);
}
BOOL fmutex(const char* fname, const char* text, long max_age)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment