assert(fname);
assert(separator);
- if ((r = read_full_file(fname, &contents, NULL)) < 0)
+ r = read_full_file(fname, &contents, NULL);
+ if (r < 0)
return r;
p = contents;
}
int write_env_file(const char *fname, char **l) {
- char **i, *p;
- FILE *f;
+ char **i;
+ char _cleanup_free_ *p = NULL;
+ FILE _cleanup_fclose_ *f = NULL;
int r;
r = fopen_temporary(fname, &f, &p);
fflush(f);
if (ferror(f)) {
- if (errno != 0)
+ if (errno > 0)
r = -errno;
else
r = -EIO;
if (r < 0)
unlink(p);
- fclose(f);
- free(p);
-
return r;
}