-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Retro ACK, but I had already looked at it before it landed in git anyway. Race the mailserver! On Wed, 2 Sep 2009, Chris Lumens wrote:
--- loader/loader.c | 67 +++++++++++++++++++------------------------------------ 1 files changed, 23 insertions(+), 44 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index 9c354fa..ff10ba5 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -860,6 +860,21 @@ static void parseCmdLineIpv6(struct loaderData_s * loaderData, char *argv) } #endif +static long argToLong(char *arg, int offset) { + long retval; + + errno = 0; + + retval = strtol(arg+offset, NULL, 10); + if ((errno == ERANGE && (retval == LONG_MIN || retval == LONG_MAX)) || + (errno != 0 && retval == 0)) { + logMessage(ERROR, "%s: %d: %m", __func__, __LINE__); + abort(); + } + + return retval; +} + /* parses /proc/cmdline for any arguments which are important to us. * NOTE: in test mode, can specify a cmdline with --cmdline */ @@ -1051,52 +1066,16 @@ static void parseCmdLineFlags(struct loaderData_s * loaderData, loaderData->ethtool = strdup(argv[i] + 8); else if (!strncasecmp(argv[i], "essid=", 6)) loaderData->essid = strdup(argv[i] + 6); - else if (!strncasecmp(argv[i], "mtu=", 4)) { - errno = 0; - loaderData->mtu = strtol(argv[i] + 4, NULL, 10); - - if ((errno == ERANGE && (loaderData->mtu == LONG_MIN || - loaderData->mtu == LONG_MAX)) || - (errno != 0 && loaderData->mtu == 0)) { - logMessage(ERROR, "%s: %d: %m", __func__, __LINE__); - abort(); - } - } + else if (!strncasecmp(argv[i], "mtu=", 4)) + loaderData->mtu = argToLong(argv[i], 4); else if (!strncasecmp(argv[i], "wepkey=", 7)) loaderData->wepkey = strdup(argv[i] + 7); - else if (!strncasecmp(argv[i], "linksleep=", 10)) { - errno = 0; - num_link_checks = strtol(argv[i] + 10, NULL, 10); - - if ((errno == ERANGE && (num_link_checks == LONG_MIN || - num_link_checks == LONG_MAX)) || - (errno != 0 && num_link_checks == 0)) { - logMessage(ERROR, "%s: %d: %m", __func__, __LINE__); - abort(); - } - } - else if (!strncasecmp(argv[i], "nicdelay=", 9)) { - errno = 0; - post_link_sleep = strtol(argv[i] + 9, NULL, 10); - - if ((errno == ERANGE && (post_link_sleep == LONG_MIN || - post_link_sleep == LONG_MAX)) || - (errno != 0 && post_link_sleep == 0)) { - logMessage(ERROR, "%s: %d: %m", __func__, __LINE__); - abort(); - } - } - else if (!strncasecmp(argv[i], "dhcptimeout=", 12)) { - errno = 0; - loaderData->dhcpTimeout = strtol(argv[i] + 12, NULL, 10); - - if ((errno == ERANGE && (loaderData->dhcpTimeout == LONG_MIN || - loaderData->dhcpTimeout == LONG_MAX)) || - (errno != 0 && loaderData->dhcpTimeout == 0)) { - logMessage(ERROR, "%s: %d: %m", __func__, __LINE__); - abort(); - } - } + else if (!strncasecmp(argv[i], "linksleep=", 10)) + num_link_checks = argToLong(argv[i], 10); + else if (!strncasecmp(argv[i], "nicdelay=", 9)) + post_link_sleep = argToLong(argv[i], 9); + else if (!strncasecmp(argv[i], "dhcptimeout=", 12)) + loaderData->dhcpTimeout = argToLong(argv[i], 12); else if (!strncasecmp(argv[i], "selinux=0", 9)) flags &= ~LOADER_FLAGS_SELINUX; else if (!strncasecmp(argv[i], "selinux", 7))
- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqgGFoACgkQ5hsjjIy1Vkn6vwCfVP7gVSB/E2twn6nGPCRXbOhz 6NkAoMKkFV7TUZz30lvzJVl09SBqjx2m =4z9X -----END PGP SIGNATURE----- _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list