mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 02:26:10 +00:00
sysctl: Fix newlines in error messages
This commit is contained in:
parent
de0ed0e2dc
commit
e6547a7e95
Notes:
sideshowbarker
2024-07-19 07:00:06 +09:00
Author: https://github.com/BenWiederhake
Commit: e6547a7e95
Pull-request: https://github.com/SerenityOS/serenity/pull/2094
1 changed files with 4 additions and 4 deletions
|
@ -45,12 +45,12 @@ static String read_var(const String& name)
|
||||||
auto path = builder.to_string();
|
auto path = builder.to_string();
|
||||||
auto f = Core::File::construct(path);
|
auto f = Core::File::construct(path);
|
||||||
if (!f->open(Core::IODevice::ReadOnly)) {
|
if (!f->open(Core::IODevice::ReadOnly)) {
|
||||||
fprintf(stderr, "open: %s", f->error_string());
|
fprintf(stderr, "open: %s\n", f->error_string());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
const auto& b = f->read_all();
|
const auto& b = f->read_all();
|
||||||
if (f->error() < 0) {
|
if (f->error() < 0) {
|
||||||
fprintf(stderr, "read: %s", f->error_string());
|
fprintf(stderr, "read: %s\n", f->error_string());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return String((const char*)b.data(), b.size(), Chomp);
|
return String((const char*)b.data(), b.size(), Chomp);
|
||||||
|
@ -64,12 +64,12 @@ static void write_var(const String& name, const String& value)
|
||||||
auto path = builder.to_string();
|
auto path = builder.to_string();
|
||||||
auto f = Core::File::construct(path);
|
auto f = Core::File::construct(path);
|
||||||
if (!f->open(Core::IODevice::WriteOnly)) {
|
if (!f->open(Core::IODevice::WriteOnly)) {
|
||||||
fprintf(stderr, "open: %s", f->error_string());
|
fprintf(stderr, "open: %s\n", f->error_string());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
f->write(value);
|
f->write(value);
|
||||||
if (f->error() < 0) {
|
if (f->error() < 0) {
|
||||||
fprintf(stderr, "write: %s", f->error_string());
|
fprintf(stderr, "write: %s\n", f->error_string());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue