]> git.proxmox.com Git - mirror_lxc.git/commitdiff
close the fd on error
authorS.Çağlar Onur <caglar@10ur.org>
Sat, 25 Jan 2014 05:46:04 +0000 (00:46 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 25 Jan 2014 23:49:18 +0000 (18:49 -0500)
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index fbf0824249b8c21df248e79d79276f4d1a84f7bb..6ea7c113e3086c97d94960509aa4e8e7c1f93678 100644 (file)
@@ -2486,8 +2486,10 @@ static int clone_update_rootfs(struct clone_update_data *data)
                        SYSERROR("unable to open %s: ignoring\n", path);
                        return 0;
                }
-               if (fprintf(fout, "%s", c->name) < 0)
+               if (fprintf(fout, "%s", c->name) < 0) {
+                       fclose(fout);
                        return -1;
+        }
                if (fclose(fout) < 0)
                        return -1;
        }