- if ((k = parse_argv(argc, argv)) < 0) {
- r = k < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
- goto finish;
- }
-
- if ((fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY)) < 0) {
- log_error("Failed to create password file: %m");
- goto finish;
- }
-
- fchmod(fd, 0644);
-
- if (!(f = fdopen(fd, "w"))) {
- log_error("Failed to allocate FILE: %m");
- goto finish;
- }
-
- fd = -1;
-
- assert_se(sigemptyset(&mask) == 0);
- sigset_add_many(&mask, SIGINT, SIGTERM, -1);
- assert_se(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
-
- if ((signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC)) < 0) {
- log_error("signalfd(): %m");
- goto finish;
- }
-
- if ((socket_fd = create_socket(&socket_name)) < 0)
- goto finish;
-
- not_after = now(CLOCK_MONOTONIC) + arg_timeout;
-
- fprintf(f,
- "[Ask]\n"
- "Socket=%s\n"
- "NotAfter=%llu\n",
- socket_name,
- (unsigned long long) not_after);
-
- if (arg_message)
- fprintf(f, "Message=%s\n", arg_message);
-
- if (arg_icon)
- fprintf(f, "Icon=%s\n", arg_icon);
-
- fflush(f);
-
- if (ferror(f)) {
- log_error("Failed to write query file: %m");