projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d29dd03
)
fileio: use _cleanup_
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 14 Mar 2013 02:47:28 +0000
(22:47 -0400)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 14 Mar 2013 02:50:04 +0000
(22:50 -0400)
src/shared/fileio.c
patch
|
blob
|
history
diff --git
a/src/shared/fileio.c
b/src/shared/fileio.c
index
4e6ff16
..
0eca441
100644
(file)
--- 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;
}