diff --git a/sbin/md5/md5.1 b/sbin/md5/md5.1 --- a/sbin/md5/md5.1 +++ b/sbin/md5/md5.1 @@ -129,6 +129,7 @@ .Pq Note that this option is not yet useful if multiple files are specified. .It Fl p , -passthrough Echo stdin to stdout and append the checksum to stdout. +In this mode, any files specified on the command line are silently ignored. .It Fl q , -quiet Quiet mode \(em only the checksum is printed out. Overrides the @@ -146,6 +147,7 @@ .It Fl s Ar string , Fl -string= Ns Ar string Print a checksum of the given .Ar string . +In this mode, any files specified on the command line are silently ignored. .It Fl t , Fl -time-trial Run a built-in time trial. For the diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -606,7 +606,7 @@ err(1, "Unable to enter capability mode"); #endif - if (*argv) { + if (*argv && !pflag && string == NULL) { do { const char *filename = *argv; const char *filemode = "rb"; diff --git a/sbin/md5/tests/md5_test.sh b/sbin/md5/tests/md5_test.sh --- a/sbin/md5/tests/md5_test.sh +++ b/sbin/md5/tests/md5_test.sh @@ -204,6 +204,8 @@ for opt in -q -qr -rq ; do atf_check -o inline:\"\$out_${i}_${alg}\n\" ${alg} \${opt} in done + atf_check -o inline:\"\$inp_${i}\$out_${i}_${alg}\n\" ${alg} -p