mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibC: Make sure that parse_pwddb_entry doesn't write to stderr
Library functions shouldn't write to stdout/stderr as that might not be expected by the caller.
This commit is contained in:
parent
302f9798ee
commit
17e5ba70b1
1 changed files with 4 additions and 4 deletions
|
@ -80,7 +80,7 @@ static bool parse_pwddb_entry(const String& line)
|
||||||
{
|
{
|
||||||
auto parts = line.split_view(':', true);
|
auto parts = line.split_view(':', true);
|
||||||
if (parts.size() != 7) {
|
if (parts.size() != 7) {
|
||||||
fprintf(stderr, "getpwent(): Malformed entry on line %u\n", s_line_number);
|
dbgln("getpwent(): Malformed entry on line {}", s_line_number);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ static bool parse_pwddb_entry(const String& line)
|
||||||
|
|
||||||
auto uid = uid_string.to_uint();
|
auto uid = uid_string.to_uint();
|
||||||
if (!uid.has_value()) {
|
if (!uid.has_value()) {
|
||||||
fprintf(stderr, "getpwent(): Malformed UID on line %u\n", s_line_number);
|
dbgln("getpwent(): Malformed UID on line {}", s_line_number);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
auto gid = gid_string.to_uint();
|
auto gid = gid_string.to_uint();
|
||||||
if (!gid.has_value()) {
|
if (!gid.has_value()) {
|
||||||
fprintf(stderr, "getpwent(): Malformed GID on line %u\n", s_line_number);
|
dbgln("getpwent(): Malformed GID on line {}", s_line_number);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ struct passwd* getpwent()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (ferror(s_stream)) {
|
if (ferror(s_stream)) {
|
||||||
fprintf(stderr, "getpwent(): Read error: %s\n", strerror(ferror(s_stream)));
|
dbgln("getpwent(): Read error: {}", strerror(ferror(s_stream)));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue