mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Add more protection when running as init and don't do stupid things.
Fix looping in fixit cdrom selection by adding a missing break. Move unmount of cdrom down to proper place.
This commit is contained in:
parent
e8f5a9d0bb
commit
60191fe961
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=21600
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: cdrom.c,v 1.31 1997/01/01 12:36:05 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.32 1997/01/06 11:10:21 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -108,8 +108,6 @@ mediaInitCDROM(Device *dev)
|
||||
cdromMounted = CD_ALREADY_MOUNTED;
|
||||
if (readInfo && (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE ||
|
||||
!(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME)))) {
|
||||
if (cdromMounted != CD_ALREADY_MOUNTED)
|
||||
unmount("/cdrom", MNT_FORCE);
|
||||
if (!cp)
|
||||
msgConfirm("Unable to find a /cdrom/cdrom.inf file.\n"
|
||||
"Either this is not a FreeBSD CDROM, there is a problem with\n"
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.147 1996/12/29 05:51:35 jkh Exp $
|
||||
* $Id: install.c,v 1.148 1997/01/06 11:10:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -254,6 +254,9 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
(void)unlink("/mnt2");
|
||||
(void)rmdir("/mnt2");
|
||||
@ -269,6 +272,8 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
if (msgYesNo("Unable to mount the CDROM - do you want to try again?") != 0)
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /cdrom, do
|
||||
@ -323,6 +328,9 @@ installFixitFloppy(dialogMenuItem *self)
|
||||
{
|
||||
struct ufs_args args;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.fspec = "/dev/fd0";
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.147 1996/12/29 05:51:35 jkh Exp $
|
||||
* $Id: install.c,v 1.148 1997/01/06 11:10:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -254,6 +254,9 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
(void)unlink("/mnt2");
|
||||
(void)rmdir("/mnt2");
|
||||
@ -269,6 +272,8 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
if (msgYesNo("Unable to mount the CDROM - do you want to try again?") != 0)
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /cdrom, do
|
||||
@ -323,6 +328,9 @@ installFixitFloppy(dialogMenuItem *self)
|
||||
{
|
||||
struct ufs_args args;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.fspec = "/dev/fd0";
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated to essentially a complete rewrite.
|
||||
*
|
||||
* $Id: cdrom.c,v 1.31 1997/01/01 12:36:05 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.32 1997/01/06 11:10:21 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -108,8 +108,6 @@ mediaInitCDROM(Device *dev)
|
||||
cdromMounted = CD_ALREADY_MOUNTED;
|
||||
if (readInfo && (DITEM_STATUS(attr_parse_file(cd_attr, "/cdrom/cdrom.inf")) == DITEM_FAILURE ||
|
||||
!(cp = attr_match(cd_attr, "CD_VERSION")) || strcmp(cp, variable_get(VAR_RELNAME)))) {
|
||||
if (cdromMounted != CD_ALREADY_MOUNTED)
|
||||
unmount("/cdrom", MNT_FORCE);
|
||||
if (!cp)
|
||||
msgConfirm("Unable to find a /cdrom/cdrom.inf file.\n"
|
||||
"Either this is not a FreeBSD CDROM, there is a problem with\n"
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: install.c,v 1.147 1996/12/29 05:51:35 jkh Exp $
|
||||
* $Id: install.c,v 1.148 1997/01/06 11:10:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -254,6 +254,9 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
{
|
||||
struct stat sb;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
(void)unlink("/mnt2");
|
||||
(void)rmdir("/mnt2");
|
||||
@ -269,6 +272,8 @@ installFixitCDROM(dialogMenuItem *self)
|
||||
if (msgYesNo("Unable to mount the CDROM - do you want to try again?") != 0)
|
||||
return DITEM_FAILURE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
/* Since the fixit code expects everything to be in /mnt2, and the CDROM mounting stuff /cdrom, do
|
||||
@ -323,6 +328,9 @@ installFixitFloppy(dialogMenuItem *self)
|
||||
{
|
||||
struct ufs_args args;
|
||||
|
||||
if (!RunningAsInit)
|
||||
return DITEM_SUCCESS;
|
||||
|
||||
variable_set2(SYSTEM_STATE, "fixit");
|
||||
memset(&args, 0, sizeof(args));
|
||||
args.fspec = "/dev/fd0";
|
||||
|
Loading…
Reference in New Issue
Block a user