#include "log.h"
#include "main-func.h"
#include "parse-util.h"
+#include "pretty-print.h"
#include "string-util.h"
#include "strv.h"
-#include "terminal-util.h"
#include "user-util.h"
#include "util.h"
case ARG_PID:
if (optarg) {
- if (parse_pid(optarg, &arg_pid) < 0) {
- log_error("Failed to parse PID %s.", optarg);
- return -EINVAL;
- }
+ if (parse_pid(optarg, &arg_pid) < 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Failed to parse PID %s.", optarg);
} else
arg_pid = getppid();
unsigned i = 0;
int r;
+ log_show_color(true);
log_parse_environment();
log_open();
if (!n)
return log_oom();
- /* If this is requested change to the requested UID/GID. Note thta we only change the real UID here, and leave
+ /* If this is requested change to the requested UID/GID. Note that we only change the real UID here, and leave
the effective UID in effect (which is 0 for this to work). That's because we want the privileges to fake the
ucred data, and sd_pid_notify() uses the real UID for filling in ucred. */
r = sd_pid_notify(arg_pid ? arg_pid : getppid(), false, n);
if (r < 0)
return log_error_errno(r, "Failed to notify init system: %m");
- if (r == 0) {
- log_error("No status data could be sent: $NOTIFY_SOCKET was not set");
- return -EOPNOTSUPP;
- }
+ if (r == 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
+ "No status data could be sent: $NOTIFY_SOCKET was not set");
return 0;
}