tags 575399 + patch thanks OoO Vers la fin de l'après-midi du jeudi 25 mars 2010, vers 16:22, Harald Dunkel <[email protected]> disait :
> Seems that genhash is broken. A line like > genhash -s www.slashdot.org -p 80 -u / > returns nothing, not even a newline or an error > message. > ??? The manual page is incorrect. "-s" only takes an IP address. Here is a patch to correct the manual page and output an error message.
diff --git a/doc/man/man1/genhash.1 b/doc/man/man1/genhash.1
index 045d77f..e761a84 100644
--- a/doc/man/man1/genhash.1
+++ b/doc/man/man1/genhash.1
@@ -22,7 +22,7 @@ program, for monitoring HTTP and HTTPS services.
Use SSL to connect to the server.
.TP
.B --server <host>, -s
-Specify the host or ip address to connect to.
+Specify the ip address to connect to.
.TP
.B --port <port>, -p
Specify the port to connect to.
diff --git a/genhash/main.c b/genhash/main.c
index 662a8ee..0f286fb 100644
--- a/genhash/main.c
+++ b/genhash/main.c
@@ -118,7 +118,10 @@ parse_cmdline(int argc, char **argv, REQ * req_obj)
req_obj->ssl = 1;
break;
case 's':
- inet_ston(optarg, &req_obj->addr_ip);
+ if (!inet_ston(optarg, &req_obj->addr_ip)) {
+ fprintf(stderr, "server should be an IP, not %s\n", optarg);
+ return CMD_LINE_ERROR;
+ }
break;
case 'V':
req_obj->vhost = optarg;
@@ -138,7 +141,10 @@ parse_cmdline(int argc, char **argv, REQ * req_obj)
req_obj->ssl = 1;
break;
case 's':
- inet_ston(optarg, &req_obj->addr_ip);
+ if (!inet_ston(optarg, &req_obj->addr_ip)) {
+ fprintf(stderr, "server should be an IP, not %s\n", optarg);
+ return CMD_LINE_ERROR;
+ }
break;
case 'V':
req_obj->vhost = optarg;
@@ -157,7 +163,7 @@ parse_cmdline(int argc, char **argv, REQ * req_obj)
/* check unexpected arguments */
if ((optarg = (char *) poptGetArg(context))) {
- fprintf(stderr, "unexpected argument %s", optarg);
+ fprintf(stderr, "unexpected argument %s\n", optarg);
return CMD_LINE_ERROR;
}
--
panic ("Splunge!");
2.2.16 /usr/src/linux/drivers/scsi/psi240i.c
pgpTTjqgxMm9N.pgp
Description: PGP signature

