1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00

Merge pull request #7755 from floppym/fileio-error

fileio: write_string_stream_ts: return errors from fputs and fputc
This commit is contained in:
Lennart Poettering 2017-12-30 12:21:53 +01:00 committed by GitHub
commit b954c051c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,9 +65,15 @@ int write_string_stream_ts(
assert(f);
assert(line);
fputs(line, f);
if (ferror(f))
return -EIO;
if (fputs(line, f) == EOF)
return -errno;
if (!(flags & WRITE_STRING_FILE_AVOID_NEWLINE) && !endswith(line, "\n"))
fputc('\n', f);
if (fputc('\n', f) == EOF)
return -errno;
if (ts) {
struct timespec twice[2] = {*ts, *ts};