#include "util.h"
#include "mkdir.h"
+#include "path-util.h"
#include "conf-parser.h"
#include "utmp-wtmp.h"
#include "socket-util.h"
#include "ask-password-api.h"
#include "strv.h"
+#include "build.h"
static enum {
ACTION_LIST,
*wall ? "\r\n\r\n" : "",
message,
pid) < 0) {
- log_error("Out of memory");
- r = -ENOMEM;
+ r = log_oom();
goto finish;
}
char *password;
if (arg_console)
- if ((tty_fd = acquire_terminal("/dev/console", false, false, false)) < 0) {
+ if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) {
r = tty_fd;
goto finish;
}
if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0)
return -ENOMEM;
- mkdir_parents(p, 0700);
+ mkdir_parents_label(p, 0700);
mkfifo(p, 0600);
fd = open(p, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
continue;
if (!(p = strappend("/run/systemd/ask-password/", de->d_name))) {
- log_error("Out of memory");
- r = -ENOMEM;
+ r = log_oom();
goto finish;
}
tty_block_fd = wall_tty_block();
- mkdir_p("/run/systemd/ask-password", 0755);
+ mkdir_p_label("/run/systemd/ask-password", 0755);
if ((notify = inotify_init1(IN_CLOEXEC)) < 0) {
r = -errno;
printf("%s [OPTIONS...]\n\n"
"Process system password requests.\n\n"
" -h --help Show this help\n"
+ " --version Show package version\n"
" --list Show pending password requests\n"
" --query Process pending password requests\n"
" --watch Continuously process password requests\n"
ARG_WATCH,
ARG_WALL,
ARG_PLYMOUTH,
- ARG_CONSOLE
+ ARG_CONSOLE,
+ ARG_VERSION
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
+ { "version", no_argument, NULL, ARG_VERSION },
{ "list", no_argument, NULL, ARG_LIST },
{ "query", no_argument, NULL, ARG_QUERY },
{ "watch", no_argument, NULL, ARG_WATCH },
help();
return 0;
+ case ARG_VERSION:
+ puts(PACKAGE_STRING);
+ puts(SYSTEMD_FEATURES);
+ return 0;
+
case ARG_LIST:
arg_action = ACTION_LIST;
break;
int main(int argc, char *argv[]) {
int r;
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();