crypt: dont error out if a file in a series fails

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
Hiltjo Posthuma 2014-03-23 12:23:56 +01:00 committed by sin
parent bc0de5e7e5
commit 7727530b53
1 changed files with 5 additions and 3 deletions

View File

@ -16,8 +16,10 @@ cryptmain(int argc, char *argv[],
mdprint(md, "<stdin>", sz);
} else {
for (; argc > 0; argc--) {
if ((fp = fopen(*argv, "r")) == NULL)
eprintf("fopen %s:", *argv);
if((fp = fopen(*argv, "r")) == NULL) {
weprintf("fopen %s:", *argv);
continue;
}
cryptsum(ops, fp, *argv, md);
mdprint(md, *argv, sz);
fclose(fp);
@ -38,7 +40,7 @@ cryptsum(struct crypt_ops *ops, FILE *fp, const char *f,
while ((n = fread(buf, 1, sizeof(buf), fp)) > 0)
ops->update(ops->s, buf, n);
if (ferror(fp)) {
eprintf("%s: read error:", f);
eprintf("read error: %s:", f);
return 1;
}
ops->sum(ops->s, md);