mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:47:45 +00:00
sysctl: Fix newlines in error messages
This commit is contained in:
parent
de0ed0e2dc
commit
e6547a7e95
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