X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftty-ask-password-agent%2Ftty-ask-password-agent.c;fp=src%2Ftty-ask-password-agent%2Ftty-ask-password-agent.c;h=5852f711730e47e0145252c175e8fcbf873b7aea;hb=36f822c4bd077f9121757e24b6516e5c7ada63b5;hp=0398a9d814ecae58d961f1cdc851ec4a8fe64b94;hpb=e1bbf3d12f28b8e3d4394f2b257e1b7aea3d10fc;p=elogind.git 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 0398a9d81..5852f7117 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);