With glibc we can use "e" in mode argument to set O_CLOEXEC on
opened files. The /etc/shadow and /etc/gshadow file handles should
be protected to make sure that they are never passed to child
processes by accident.
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
if (NULL != shadow) {
rewind (shadow);
} else {
- shadow = fopen (SGROUP_FILE, "r");
+ shadow = fopen (SGROUP_FILE, "re");
}
}
if (NULL != shadow) {
rewind (shadow);
}else {
- shadow = fopen (SHADOW_FILE, "r");
+ shadow = fopen (SHADOW_FILE, "re");
}
}