Changed permissions for semafore reading

This commit is contained in:
Michiel Broek
2005-03-14 22:32:38 +00:00
parent 5d4359200e
commit 5f564c380e
3 changed files with 14 additions and 2 deletions

View File

@@ -268,14 +268,17 @@ void CreateSema(char *sem)
{
char temp[PATH_MAX];
FILE *fp;
int oldmask;
sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem);
if (access(temp, F_OK) == 0)
return;
oldmask = umask(002);
if ((fp = fopen(temp, "w")))
fclose(fp);
else
Syslog('?', "Can't create semafore %s", temp);
umask(oldmask);
}
@@ -284,12 +287,15 @@ void TouchSema(char *sem)
{
char temp[PATH_MAX];
FILE *fp;
int oldmask;
sprintf(temp, "%s/var/sema/%s", getenv("MBSE_ROOT"), sem);
oldmask = umask(002);
if ((fp = fopen(temp, "w")))
fclose(fp);
else
Syslog('?', "Can't touch semafore %s", temp);
umask(oldmask);
}