Merge pull request #10440 from poettering/fflush-and-check-some-more

use fflush_and_check() and free_and_replace() where we can
This commit is contained in:
Lennart Poettering
2018-10-17 22:54:34 +02:00
committed by GitHub
2 changed files with 8 additions and 9 deletions
+4 -3
View File
@@ -268,8 +268,8 @@ static int gather_environment_generate(int fd, void *arg) {
}
static int gather_environment_collect(int fd, void *arg) {
char ***env = arg;
_cleanup_fclose_ FILE *f = NULL;
char ***env = arg;
int r;
/* Write out a series of env=cescape(VAR=value) assignments to fd. */
@@ -286,8 +286,9 @@ static int gather_environment_collect(int fd, void *arg) {
if (r < 0)
return r;
if (ferror(f))
return errno > 0 ? -errno : -EIO;
r = fflush_and_check(f);
if (r < 0)
return r;
return 0;
}