svn commit: r317717 - stable/11/contrib/elftoolchain/strings

Ed Maste emaste at FreeBSD.org
Wed May 3 02:04:39 UTC 2017


Author: emaste
Date: Wed May  3 02:04:38 2017
New Revision: 317717
URL: https://svnweb.freebsd.org/changeset/base/317717

Log:
  MFC r312779: strings: avoid unnecessary trip through handle_file for stdin
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/11/contrib/elftoolchain/strings/strings.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/elftoolchain/strings/strings.c
==============================================================================
--- stable/11/contrib/elftoolchain/strings/strings.c	Wed May  3 01:57:06 2017	(r317716)
+++ stable/11/contrib/elftoolchain/strings/strings.c	Wed May  3 02:04:38 2017	(r317717)
@@ -189,7 +189,7 @@ main(int argc, char **argv)
 	if (!min_len)
 		min_len = 4;
 	if (!*argv)
-		rc = handle_file("{standard input}");
+		rc = find_strings("{standard input}", 0, 0);
 	else while (*argv) {
 		if (handle_file(*argv) != 0)
 			rc = 1;
@@ -205,13 +205,9 @@ handle_file(const char *name)
 
 	if (name == NULL)
 		return (1);
-	if (strcmp("{standard input}", name) != 0) {
-		if (freopen(name, "rb", stdin) == NULL) {
-			warnx("'%s': %s", name, strerror(errno));
-			return (1);
-		}
-	} else {
-		return (find_strings(name, (off_t)0, (off_t)0));
+	if (freopen(name, "rb", stdin) == NULL) {
+		warnx("'%s': %s", name, strerror(errno));
+		return (1);
 	}
 
 	fd = fileno(stdin);


More information about the svn-src-all mailing list