libc: Propagate errors correctly in shadow functions
All checks were successful
Build and test / build (push) Successful in 2m58s
All checks were successful
Build and test / build (push) Successful in 2m58s
This commit is contained in:
parent
62cb53069c
commit
e2ff0ad273
@ -16,7 +16,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
struct spwd* result;
|
struct spwd* result;
|
||||||
|
|
||||||
getspent_r(&spwd, s_buf, sizeof(s_buf), &result);
|
if (getspent_r(&spwd, s_buf, sizeof(s_buf), &result) < 0) return nullptr;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ extern "C"
|
|||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
f = fopen("/etc/shadow", "r");
|
f = fopen("/etc/shadow", "r");
|
||||||
if (!f) return 0;
|
if (!f) return -1;
|
||||||
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
fcntl(fileno(f), F_SETFD, FD_CLOEXEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user