summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-13 22:47:28 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-13 22:50:04 -0400
commit1c17cbed55376b13ed09ec91cd888cb810451026 (patch)
tree1557303f5e451abcb97287f807528700bd17346a /src
parentd29dd033022b41794c7475a5ec4d9d683d18417e (diff)
fileio: use _cleanup_
Diffstat (limited to 'src')
-rw-r--r--src/shared/fileio.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index 4e6ff16045..0eca4416f8 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -187,7 +187,8 @@ int parse_env_file(
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;
@@ -343,8 +344,9 @@ int load_env_file(const char *fname, char ***rl) {
}
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);
@@ -376,8 +378,5 @@ int write_env_file(const char *fname, char **l) {
if (r < 0)
unlink(p);
- fclose(f);
- free(p);
-
return r;
}