2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-23 11:40:25 +00:00

Protect umount_chroot from running with rootimage_dir undefined

This commit is contained in:
Matt Ezell
2016-08-17 11:00:18 -04:00
parent 2a4b574468
commit 7225f2e586
2 changed files with 10 additions and 1 deletions

View File

@@ -70,7 +70,7 @@ my $noupdate;
sub xdie {
system("rm -rf /tmp/xcatinitrd.$$");
umount_chroot($rootimage_dir);
umount_chroot($rootimg_dir);
die @_;
}
@@ -112,6 +112,10 @@ sub mount_chroot {
sub umount_chroot {
my $rootimage_dir = shift;
if ($rootimage_dir eq "") {
print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n";
return 1;
}
if (majversion($osver) > 6) {
system("umount -l $rootimage_dir/proc");

View File

@@ -2094,6 +2094,11 @@ sub mount_chroot {
sub umount_chroot {
my $rootimage_dir = shift;
if ($rootimage_dir eq "") {
print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n";
return 1;
}
system("umount -l $rootimage_dir/proc");
system("umount -l $rootimage_dir/sys");