summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley2006-06-07 21:22:42 +0000
committerRob Landley2006-06-07 21:22:42 +0000
commit6d8ce170b0be743f761244f467cdaa5f4318638d (patch)
tree9eb1bcdc6c73b7512c3611911275f28d06ec94c5
parent5929edc1fac4340f99ed84e92bf3a2bedd4177c2 (diff)
downloadbusybox-6d8ce170b0be743f761244f467cdaa5f4318638d.zip
busybox-6d8ce170b0be743f761244f467cdaa5f4318638d.tar.gz
Fix from Tito to read from stdin only when it's not a tty.
-rw-r--r--include/usage.h2
-rw-r--r--miscutils/hdparm.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/include/usage.h b/include/usage.h
index 9bdfb3f..0349f69 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -994,7 +994,7 @@ USE_FEATURE_DATE_ISOFMT( \
#define hdparm_trivial_usage \
"[options] [device] .."
#define hdparm_full_usage \
- USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified read from stdin.\n") \
+ USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified try to read from stdin.\n") \
"\nOptions:\n" \
"\t-a get/set fs readahead\n" \
"\t-A set drive read-lookahead flag (0/1)\n" \
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 5703ece..512995a 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -2185,11 +2185,11 @@ int hdparm_main(int argc, char **argv)
argc -= optind;
argv += optind;
-#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
if (argc < 1) {
- identify_from_stdin(); /* EXIT */
+ if (ENABLE_FEATURE_HDPARM_GET_IDENTITY && !isatty(STDIN_FILENO))
+ identify_from_stdin(); /* EXIT */
+ else bb_show_usage();
}
-#endif
while (argc--) {
process_dev(*argv);