Replace a handful of calls to ErrorF and exit(1) with a single call to

FatalError. These direct calls to exit(1) made it impossible to do
    anything ddx-specific in these cases; note that most of these calls
    occur during argument processing.
This commit is contained in:
Harold L Hunt II 2004-03-02 19:28:53 +00:00
parent cb3bd448f9
commit 07d141d45c
2 changed files with 18 additions and 34 deletions

View file

@ -603,7 +603,7 @@ ProcessCommandLine(int argc, char *argv[])
if( ! VerifyDisplayName( display ) ) {
ErrorF("Bad display name: %s\n", display);
UseMsg();
exit(1);
FatalError("Bad display name, exiting: %s\n", display);
}
}
else if ( strcmp( argv[i], "-a") == 0)
@ -981,7 +981,7 @@ ProcessCommandLine(int argc, char *argv[])
{
ErrorF("Unrecognized option: %s\n", argv[i]);
UseMsg();
exit (1);
FatalError("Unrecognized option: %s\n", argv[i]);
}
}
}

View file

@ -279,8 +279,7 @@ XdmcpOptions(int argc, char **argv, int i)
}
if (strcmp(argv[i], "-port") == 0) {
if (++i == argc) {
ErrorF("Xserver: missing port number in command line\n");
exit(1);
FatalError("Xserver: missing port number in command line\n");
}
xdm_udp_port = (unsigned short) atoi(argv[i]);
return (i + 1);
@ -295,8 +294,7 @@ XdmcpOptions(int argc, char **argv, int i)
}
if (strcmp(argv[i], "-class") == 0) {
if (++i == argc) {
ErrorF("Xserver: missing class name in command line\n");
exit(1);
FatalError("Xserver: missing class name in command line\n");
}
defaultDisplayClass = argv[i];
return (i + 1);
@ -304,8 +302,7 @@ XdmcpOptions(int argc, char **argv, int i)
#ifdef HASXDMAUTH
if (strcmp(argv[i], "-cookie") == 0) {
if (++i == argc) {
ErrorF("Xserver: missing cookie data in command line\n");
exit(1);
FatalError("Xserver: missing cookie data in command line\n");
}
xdmAuthCookie = argv[i];
return (i + 1);
@ -313,8 +310,7 @@ XdmcpOptions(int argc, char **argv, int i)
#endif
if (strcmp(argv[i], "-displayID") == 0) {
if (++i == argc) {
ErrorF("Xserver: missing displayID in command line\n");
exit(1);
FatalError("Xserver: missing displayID in command line\n");
}
XdmcpRegisterManufacturerDisplayID (argv[i], strlen (argv[i]));
return (i + 1);
@ -1069,8 +1065,7 @@ get_xdmcp_sock(void)
if (xdmcpSocket >= 0 && xdm_from != NULL) {
if (bind(xdmcpSocket, (struct sockaddr *)&FromAddress,
FromAddressLen) < 0) {
ErrorF("Xserver: failed to bind to -from address: %s\n", xdm_from);
exit(1);
FatalError("Xserver: failed to bind to -from address: %s\n", xdm_from);
}
}
#endif /* STREAMSCONN */
@ -1502,8 +1497,7 @@ get_addr_by_name(
} else if (port > 0 && port < 65535) {
sprintf(portstr, "%d", port);
} else {
ErrorF("Xserver: port out of range: %d\n", port);
exit(1);
FatalError("Xserver: port out of range: %d\n", port);
}
if (*aifirstp != NULL) {
@ -1517,17 +1511,15 @@ get_addr_by_name(
break;
}
if ((ai == NULL) || (ai->ai_addrlen > sizeof(SOCKADDR_TYPE))) {
ErrorF ("Xserver: %s host %s not on supported network type\n",
FatalError ("Xserver: %s host %s not on supported network type\n",
argtype, namestr);
exit (1);
} else {
*aip = ai;
*addrlen = ai->ai_addrlen;
memcpy(addr, ai->ai_addr, ai->ai_addrlen);
}
} else {
ErrorF("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr);
exit(1);
FatalError("Xserver: %s: %s %s\n", gai_strerror(gaierr), argtype, namestr);
}
#else
struct hostent *hep;
@ -1537,8 +1529,7 @@ get_addr_by_name(
if (!(hep = _XGethostbyname(namestr, hparams)))
{
ErrorF("Xserver: %s unknown host: %s\n", argtype, namestr);
exit(1);
FatalError("Xserver: %s unknown host: %s\n", argtype, namestr);
}
if (hep->h_length == sizeof (struct in_addr))
{
@ -1549,8 +1540,7 @@ get_addr_by_name(
}
else
{
ErrorF ("Xserver: %s host on strange network %s\n", argtype, namestr);
exit (1);
FatalError("Xserver: %s host on strange network %s\n", argtype, namestr);
}
#endif
}
@ -1564,8 +1554,7 @@ get_manager_by_name(
if ((i + 1) == argc)
{
ErrorF("Xserver: missing %s host name in command line\n", argv[i]);
exit(1);
FatalError("Xserver: missing %s host name in command line\n", argv[i]);
}
get_addr_by_name(argv[i], argv[i+1], xdm_udp_port, SOCK_DGRAM,
@ -1589,8 +1578,7 @@ get_fromaddr_by_name(
#endif
if (i == argc)
{
ErrorF("Xserver: missing -from host name in command line\n");
exit(1);
FatalError("Xserver: missing -from host name in command line\n");
}
get_addr_by_name("-from", argv[i], 0, 0, &FromAddress, &FromAddressLen
#if defined(IPv6) && defined(AF_INET6)
@ -1619,9 +1607,8 @@ get_mcast_options(argc, argv, i)
if ((i < argc) && (argv[i][0] != '-') && (argv[i][0] != '+')) {
hopcount = strtol(argv[i++], NULL, 10);
if ((hopcount < 1) || (hopcount > 255)) {
ErrorF("Xserver: multicast hop count out of range: %d\n",
FatalError("Xserver: multicast hop count out of range: %d\n",
hopcount);
exit(1);
}
}
}
@ -1629,8 +1616,7 @@ get_mcast_options(argc, argv, i)
if (xdm_udp_port > 0 && xdm_udp_port < 65535) {
sprintf(portstr, "%d", xdm_udp_port);
} else {
ErrorF("Xserver: port out of range: %d\n", xdm_udp_port);
exit(1);
FatalError("Xserver: port out of range: %d\n", xdm_udp_port);
}
bzero(&hints, sizeof(hints));
hints.ai_socktype = SOCK_DGRAM;
@ -1646,9 +1632,8 @@ get_mcast_options(argc, argv, i)
break;
}
if (ai == NULL) {
ErrorF ("Xserver: address not supported multicast type %s\n",
FatalError ("Xserver: address not supported multicast type %s\n",
address);
exit (1);
} else {
struct multicastinfo *mcastinfo, *mcl;
@ -1667,8 +1652,7 @@ get_mcast_options(argc, argv, i)
}
}
} else {
ErrorF("Xserver: %s: %s\n", gai_strerror(gaierr), address);
exit(1);
FatalError("Xserver: %s: %s\n", gai_strerror(gaierr), address);
}
return i;
}