summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2017-05-03 02:04:38 +0000
committeremaste <emaste@FreeBSD.org>2017-05-03 02:04:38 +0000
commit820bd9717106bb769c90e69111e287eda4cd18a9 (patch)
treee9ca731403ff9b081b526e4947ebc81ea66ebe44 /contrib/elftoolchain
parentf7c08dd2f80cc8ae2724991b203c31fb1335db67 (diff)
downloadFreeBSD-src-820bd9717106bb769c90e69111e287eda4cd18a9.zip
FreeBSD-src-820bd9717106bb769c90e69111e287eda4cd18a9.tar.gz
MFC r312779: strings: avoid unnecessary trip through handle_file for stdin
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r--contrib/elftoolchain/strings/strings.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/contrib/elftoolchain/strings/strings.c b/contrib/elftoolchain/strings/strings.c
index fbc8001..0395429 100644
--- a/contrib/elftoolchain/strings/strings.c
+++ b/contrib/elftoolchain/strings/strings.c
@@ -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);
OpenPOWER on IntegriCloud