diff options
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 0398a9d814..5852f71173 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -258,25 +258,16 @@ static int parse_password(const char *filename, char **wall) { { NULL, NULL, NULL, 0, NULL } }; - FILE *f; int r; assert(filename); - f = fopen(filename, "re"); - if (!f) { - if (errno == ENOENT) - return 0; - - log_error("open(%s): %m", filename); - return -errno; - } - - r = config_parse(NULL, filename, f, NULL, config_item_table_lookup, items, true, false, NULL); - if (r < 0) { - log_error("Failed to parse password file %s: %s", filename, strerror(-r)); - goto finish; - } + r = config_parse(NULL, filename, NULL, + NULL, + config_item_table_lookup, items, + true, false, true, NULL); + if (r < 0) + return r; if (!socket_name) { log_error("Invalid password file %s", filename); @@ -414,8 +405,6 @@ static int parse_password(const char *filename, char **wall) { } finish: - fclose(f); - safe_close(socket_fd); free(packet); |