fileio: write_string_stream_ts: return errors from fputs and fputc
Ignoring errors from these functions may mask errors returned by the kernel. Fixes: https://github.com/systemd/systemd/issues/7744
This commit is contained in:
parent
d31eb24fc2
commit
94d3b60ff6
|
@ -65,9 +65,12 @@ int write_string_stream_ts(
|
||||||
assert(f);
|
assert(f);
|
||||||
assert(line);
|
assert(line);
|
||||||
|
|
||||||
fputs(line, f);
|
if (fputs(line, f) == EOF)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
if (!(flags & WRITE_STRING_FILE_AVOID_NEWLINE) && !endswith(line, "\n"))
|
if (!(flags & WRITE_STRING_FILE_AVOID_NEWLINE) && !endswith(line, "\n"))
|
||||||
fputc('\n', f);
|
if (fputc('\n', f) == EOF)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
if (ts) {
|
if (ts) {
|
||||||
struct timespec twice[2] = {*ts, *ts};
|
struct timespec twice[2] = {*ts, *ts};
|
||||||
|
|
Loading…
Reference in a new issue