r = 0;
finish:
- if (notify >= 0)
- close_nointr_nofail(notify);
-
- if (fd >= 0)
- close_nointr_nofail(fd);
+ safe_close(notify);
+ safe_close(fd);
free(packet);
r = ask_password_tty(message, not_after, filename, &password);
if (arg_console) {
- close_nointr_nofail(tty_fd);
+ safe_close(tty_fd);
release_terminal();
}
finish:
fclose(f);
- if (socket_fd >= 0)
- close_nointr_nofail(socket_fd);
+ safe_close(socket_fd);
free(packet);
free(socket_name);
r = get_ctty_devnr(0, &devnr);
if (r < 0)
- return -r;
+ return r;
if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0)
return -ENOMEM;
return true;
/* What, we managed to open the pipe? Then this tty is filtered. */
- close_nointr_nofail(fd);
+ safe_close(fd);
return false;
}
if (errno == ENOENT)
return 0;
- log_error("opendir(): %m");
+ log_error("opendir(/run/systemd/ask-password): %m");
return -errno;
}
r = 0;
finish:
- if (notify >= 0)
- close_nointr_nofail(notify);
-
- if (signal_fd >= 0)
- close_nointr_nofail(signal_fd);
-
- if (tty_block_fd >= 0)
- close_nointr_nofail(tty_block_fd);
+ safe_close(notify);
+ safe_close(signal_fd);
+ safe_close(tty_block_fd);
return r;
}