mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-23 03:30:33 +00:00
Protect umount_chroot from running with rootimage_dir undefined
This commit is contained in:
@@ -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");
|
||||
|
@@ -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");
|
||||
|
Reference in New Issue
Block a user