Skip to content
Snippets Groups Projects
Commit df7dc041 authored by Filippos Giannakos's avatar Filippos Giannakos
Browse files

xseg_posixfd: Add S_ISGID bit to fifo's directory

Add S_ISGID bit to fifo's directory. This way each fifo created under this
directory inherits the group id of the POSIXFD directory. This enables different
Archipelago components to signal each other independently from their effective
user id.
parent 6e15674c
No related branches found
No related tags found
No related merge requests found
......@@ -194,14 +194,15 @@ static void posixfd_local_signal_quit(struct xseg *xseg, xport portno)
/*
* When this peer type is initialized, we must make sure the directory where the
* named pipes will be created, exist.
* named pipes will be created, exist. Also make sure that th setgid bit is set.
*/
static int posixfd_remote_signal_init(void)
{
int r;
mode_t oldumask;
struct stat st;
oldumask = umask(0000);
r = mkdir(POSIXFD_DIR, 01777);
r = mkdir(POSIXFD_DIR, S_IRWXU|S_IRWXG);
umask(oldumask);
if (r < 0) {
......@@ -209,6 +210,20 @@ static int posixfd_remote_signal_init(void)
return -1;
}
r = stat(POSIXFD_DIR, &st);
if (r < 0) {
return -1;
}
if (st.st_mode & S_ISGID) {
return 0;
}
r = chmod(POSIXFD_DIR, st.st_mode | S_ISGID);
if (r < 0) {
return -1;
}
return 0;
}
......
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