tmpfiles: Fix file descriptor leak on error

Detected by cppcheck
This commit is contained in:
Thomas Jarosch
2013-01-03 22:42:55 +01:00
committed by Lennart Poettering
parent 1c981ff22e
commit 3785ba6966
+3 -1
View File
@@ -507,8 +507,10 @@ static int write_one_file(Item *i, const char *path) {
_cleanup_free_ char *unescaped;
unescaped = cunescape(i->argument);
if (unescaped == NULL)
if (unescaped == NULL) {
close_nointr_nofail(fd);
return log_oom();
}
l = strlen(unescaped);
n = write(fd, unescaped, l);