commit 44a6d65832fcd7a6d21cb539bb2ceabbb467f6fd
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed Mar 23 19:12:28 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Sat Mar 26 08:18:47 2016 +0000
*sum: support - when using -c
Signed-off-by: Mattias Andrée <maandree_AT_kth.se>
diff --git a/libutil/crypt.c b/libutil/crypt.c
index 0de4269..3f849ba 100644
--- a/libutil/crypt.c
+++ b/libutil/crypt.c
_AT_@ -89,13 +89,16 @@ cryptcheck(int argc, char *argv[], struct crypt_ops *ops, uint8_t *md, size_t sz
mdchecklist(stdin, ops, md, sz, &formatsucks, &noread, &nonmatch);
} else {
for (; *argv; argc--, argv++) {
- if (!(fp = fopen(*argv, "r"))) {
+ if ((*argv)[0] == '-' && !(*argv)[1]) {
+ fp = stdin;
+ } else if (!(fp = fopen(*argv, "r"))) {
weprintf("fopen %s:", *argv);
ret = 1;
continue;
}
mdchecklist(fp, ops, md, sz, &formatsucks, &noread, &nonmatch);
- fclose(fp);
+ if (fp != stdin)
+ fclose(fp);
}
}
Received on Sat Mar 26 2016 - 09:18:52 CET
This archive was generated by hypermail 2.3.0
: Sat Mar 26 2016 - 09:24:18 CET