2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-25 13:12:03 +00:00

Merge pull request #1724 from mattaezell/xdie_rootimgdir

Protect umount_chroot from running with rootimage_dir undefined
This commit is contained in:
Weihua Hu 2016-09-28 14:24:24 +08:00 committed by GitHub
commit d46d34f8b8
2 changed files with 9 additions and 0 deletions

View File

@ -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

@ -2110,6 +2110,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");