diff options
author | Sami Kerola | 2012-02-07 23:01:14 +0100 |
---|---|---|
committer | Karel Zak | 2012-02-08 14:23:28 +0100 |
commit | dd41e06795638795345a0a4da9510f948ad81906 (patch) | |
tree | b7aa69406a5a8c971dc0e1d67a93056ad34826f3 /sys-utils/switch_root.c | |
parent | chcpu: use appropriate variable type [cppcheck] (diff) | |
download | kernel-qcow2-util-linux-dd41e06795638795345a0a4da9510f948ad81906.tar.gz kernel-qcow2-util-linux-dd41e06795638795345a0a4da9510f948ad81906.tar.xz kernel-qcow2-util-linux-dd41e06795638795345a0a4da9510f948ad81906.zip |
switch_root: close open file after usage [cppcheck]
[sys-utils/switch_root.c:159]: (error) Resource leak: cfd
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/switch_root.c')
-rw-r--r-- | sys-utils/switch_root.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c index 1c7375dbe..0da784295 100644 --- a/sys-utils/switch_root.c +++ b/sys-utils/switch_root.c @@ -155,11 +155,13 @@ static int switchroot(const char *newroot) cfd = open("/", O_RDONLY); if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) { + close(cfd); warn(_("failed to mount moving %s to /"), newroot); return -1; } if (chroot(".")) { + close(cfd); warn(_("failed to change root")); return -1; } |