mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-18 18:49:50 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/17e5ba70b17 Pull-request: https://github.com/SerenityOS/serenity/pull/6777 Reviewed-by: https://github.com/awesomekling
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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -94,12 +94,12 @@ static bool parse_pwddb_entry(const String& line)
|
|||
|
||||
auto uid = uid_string.to_uint();
|
||||
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;
|
||||
}
|
||||
auto gid = gid_string.to_uint();
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ struct passwd* getpwent()
|
|||
return nullptr;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue