diff --git a/sbin/md5/md5.c b/sbin/md5/md5.c --- a/sbin/md5/md5.c +++ b/sbin/md5/md5.c @@ -611,11 +611,16 @@ const char *filename = *argv; const char *filemode = "rb"; + if (strcmp(filename, "-") == 0) { + f = stdin; + } else { #ifdef HAVE_CAPSICUM - if ((f = fileargs_fopen(fa, filename, filemode)) == NULL) { + f = fileargs_fopen(fa, filename, filemode); #else - if ((f = fopen(filename, filemode)) == NULL) { + f = fopen(filename, filemode); #endif + } + if (f == NULL) { if (errno != ENOENT || !(cflag && ignoreMissing)) { warn("%s", filename); failed = true;