Mercurial > projects > pwm
diff pwm.c @ 5:0b1bce8db371
Prevent misleading double error message
Display errors from the function where they occur. Only use warn(x) for system
errors.
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Sun, 05 Feb 2017 13:54:39 +0100 |
parents | a7e41e1a79c8 |
children | cf81eb0c2d5a |
line wrap: on
line diff
--- a/pwm.c Sun Feb 05 13:30:31 2017 +0100 +++ b/pwm.c Sun Feb 05 13:54:39 2017 +0100 @@ -197,10 +197,12 @@ password_len--; if (password_len == 0) { /* first line is empty */ + fprintf(stderr, "malformed password file\n"); goto out; } } else if (!feof(fp)) { /* the first line was truncated, password is too long */ + fprintf(stderr, "malformed password file\n"); goto out; } memcpy(password, buf, password_size); @@ -318,7 +320,6 @@ if (master_password_filename != NULL) { if (read_password_from_file(master_password_filename, ctx.password, sizeof (ctx.password)) != 0) { - fprintf(stderr, "malformed password database\n"); goto out; } } else {