switch_root: check open() return value [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
fee9431f97
commit
17df84df27
|
@ -154,6 +154,10 @@ static int switchroot(const char *newroot)
|
|||
}
|
||||
|
||||
cfd = open("/", O_RDONLY);
|
||||
if (cfd < 0) {
|
||||
warn(_("cannot open %s"), "/");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mount(newroot, "/", NULL, MS_MOVE, NULL) < 0) {
|
||||
close(cfd);
|
||||
|
|
Loading…
Reference in New Issue