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
......@@ -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);
......
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