lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 27 Nov 2008 04:11:12 +0000
From:	Ben Hutchings <ben@...adent.org.uk>
To:	Jeff Garzik <jgarzik@...ox.com>
Cc:	netdev@...r.kernel.org
Subject: [PATCH 1/2] ethtool: Show short message for syntax error

In case of a syntax error it's likely to be more helpful to just say
that rather than showing the entire usage information, which is now
very long.

Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
This change has been in Debian for some years, made in response to
bug report http://bugs.debian.org/256249

Ben.

--- ethtool-6+20080227.orig/ethtool.c
+++ ethtool-6+20080227/ethtool.c
@@ -196,15 +196,24 @@
 static void show_usage(int badarg)
 {
 	int i;
-	fprintf(stderr, PACKAGE " version " VERSION "\n");
-	fprintf(stderr,
+	if (badarg != 0) {
+		fprintf(stderr,
+			"ethtool: bad command line argument(s)\n"
+			"For more information run ethtool -h\n"
+		);
+	}
+	else {
+		/* ethtool -h */
+		fprintf(stdout, PACKAGE " version " VERSION "\n");
+		fprintf(stdout,
 		"Usage:\n"
 		"ethtool DEVNAME\tDisplay standard information about device\n");
-	for (i = 0; args[i].srt; i++) {
-		fprintf(stderr, "        ethtool %s|%s DEVNAME\t%s\n%s",
-			args[i].srt, args[i].lng,
-			args[i].help,
-			args[i].opthelp ? args[i].opthelp : "");
+		for (i = 0; args[i].srt; i++) {
+			fprintf(stdout, "        ethtool %s|%s DEVNAME\t%s\n%s",
+				args[i].srt, args[i].lng,
+				args[i].help,
+				args[i].opthelp ? args[i].opthelp : "");
+		}
 	}
 	exit(badarg);
 }

-- 
Ben Hutchings
Time is nature's way of making sure that everything doesn't happen at once.

Download attachment "signature.asc" of type "application/pgp-signature" (190 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ