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

fmutex() will write the local hostname to the file if no text specified.

parent 8e8ced8d
No related branches found
No related tags found
No related merge requests found
......@@ -115,9 +115,12 @@ BOOL ftouch(const char* fname)
BOOL fmutex(const char* fname, const char* text)
{
int file;
char hostname[128];
if((file=open(fname,O_CREAT|O_WRONLY|O_EXCL,S_IREAD|S_IWRITE))<0)
return(FALSE);
if(text==NULL && gethostname(hostname,sizeof(hostname))==0)
text=hostname;
if(text!=NULL)
write(file,text,strlen(text));
close(file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment