creds: minor tweak for fputc() error handling

Let's do not assume errno is set for return values other than
EOF, following what we do in fileio.c.
This commit is contained in:
Mike Yuan
2026-03-26 16:01:35 +01:00
parent 64d1c102ad
commit 734af2908a
+1 -1
View File
@@ -416,7 +416,7 @@ static int print_newline(FILE *f, const char *data, size_t l) {
return 0;
}
if (fputc('\n', f) != '\n')
if (fputc('\n', f) == EOF)
return log_error_errno(errno, "Failed to write trailing newline: %m");
return 1;