Enable Basilisk II to work even if slirp_init() failed. Disable ethernet

emulation in that case, don't exit(1).
This commit is contained in:
gbeauche 2005-06-12 22:48:48 +00:00
parent e308e5441b
commit 2bc79fd857
5 changed files with 12 additions and 7 deletions

View File

@ -224,7 +224,11 @@ bool ether_init(void)
#ifdef HAVE_SLIRP
// Initialize slirp library
if (net_if_type == NET_IF_SLIRP) {
slirp_init();
if (slirp_init() < 0) {
sprintf(str, GetString(STR_SLIRP_NO_DNS_FOUND_WARN));
WarningAlert(str);
return false;
}
// Open slirp output pipe
int fds[2];

View File

@ -49,6 +49,7 @@ user_string_def platform_strings[] = {
{STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."},
{STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."},
{STR_TUN_TAP_CONFIG_WARN, "Cannot configure TUN/TAP device (%s). Ethernet will not be available."},
{STR_SLIRP_NO_DNS_FOUND_WARN, "Cannot get DNS address. Ethernet will not be available."},
{STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."},
{STR_SCSI_DEVICE_NOT_SCSI_WARN, "%s doesn't seem to comply to the Generic SCSI API. SCSI Manager access to this device will be disabled."},
{STR_NO_AUDIO_DEV_WARN, "Cannot open %s (%s). Audio output will be disabled."},

View File

@ -40,6 +40,7 @@ enum {
STR_NO_SHEEP_NET_DRIVER_WARN,
STR_SHEEP_NET_ATTACH_WARN,
STR_TUN_TAP_CONFIG_WARN,
STR_SLIRP_NO_DNS_FOUND_WARN,
STR_SCSI_DEVICE_OPEN_WARN,
STR_SCSI_DEVICE_NOT_SCSI_WARN,
STR_NO_AUDIO_DEV_WARN,

View File

@ -13,7 +13,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
extern "C" {
#endif
void slirp_init(void);
int slirp_init(void);
void slirp_select_fill(int *pnfds,
fd_set *readfds, fd_set *writefds, fd_set *xfds);

View File

@ -123,7 +123,7 @@ void slirp_cleanup(void)
}
#endif
void slirp_init(void)
int slirp_init(void)
{
// debug_init("/tmp/slirp.log", DEBUG_DEFAULT);
@ -147,12 +147,11 @@ void slirp_init(void)
getouraddr();
inet_aton("127.0.0.1", &loopback_addr);
if (get_dns_addr(&dns_addr) < 0) {
fprintf(stderr, "Could not get DNS address\n");
exit(1);
}
if (get_dns_addr(&dns_addr) < 0)
return -1;
inet_aton(CTL_SPECIAL, &special_addr);
return 0;
}
#define CONN_CANFSEND(so) (((so)->so_state & (SS_FCANTSENDMORE|SS_ISFCONNECTED)) == SS_ISFCONNECTED)