lib/: Set O_CLOEXEC for static FILE handles
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>
This commit is contained in:
committed by
Alejandro Colomar
parent
a772484f00
commit
aebc4dd8c6
@@ -55,7 +55,7 @@ void setsgent (void)
|
||||
if (NULL != shadow) {
|
||||
rewind (shadow);
|
||||
} else {
|
||||
shadow = fopen (SGROUP_FILE, "r");
|
||||
shadow = fopen (SGROUP_FILE, "re");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void setspent (void)
|
||||
if (NULL != shadow) {
|
||||
rewind (shadow);
|
||||
}else {
|
||||
shadow = fopen (SHADOW_FILE, "r");
|
||||
shadow = fopen (SHADOW_FILE, "re");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user