#include "alloc-util.h"
#include "bus-common-errors.h"
#include "bus-error.h"
+#include "bus-locator.h"
#include "bus-util.h"
#include "device-util.h"
#include "fd-util.h"
#include "path-util.h"
#include "proc-cmdline.h"
#include "process-util.h"
-#include "rlimit-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "special.h"
#include "stdio-util.h"
-#include "util.h"
static bool arg_skip = false;
static bool arg_force = false;
log_info("Requesting %s/start/%s", target, mode);
/* Start this unit only if we can replace basic.target with it */
- r = sd_bus_call_method(bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "StartUnitReplace",
- &error,
- NULL,
- "sss", "basic.target", target, mode);
+ r = bus_call_method(bus, bus_systemd_mgr, "StartUnitReplace", &error, NULL, "sss", "basic.target", target, mode);
/* Don't print a warning if we aren't called during startup */
if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
}
static int fsck_progress_socket(void) {
- _cleanup_close_ int fd = -1;
+ _cleanup_close_ int fd = -EBADF;
int r;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
}
static int run(int argc, char *argv[]) {
- _cleanup_close_pair_ int progress_pipe[2] = { -1, -1 };
+ _cleanup_close_pair_ int progress_pipe[2] = EBADF_PAIR;
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
_cleanup_free_ char *dpath = NULL;
_cleanup_fclose_ FILE *console = NULL;
pipe(progress_pipe) < 0)
return log_error_errno(errno, "pipe(): %m");
- r = safe_fork("(fsck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid);
+ r = safe_fork("(fsck)", FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_LOG|FORK_RLIMIT_NOFILE_SAFE, &pid);
if (r < 0)
return r;
if (r == 0) {
} else
dash_c[0] = 0;
- cmdline[i++] = "/sbin/fsck";
+ cmdline[i++] = "fsck";
cmdline[i++] = arg_repair;
cmdline[i++] = "-T";
cmdline[i++] = device;
cmdline[i++] = NULL;
- (void) rlimit_nofile_safe();
-
- execv(cmdline[0], (char**) cmdline);
+ execvp(cmdline[0], (char**) cmdline);
_exit(FSCK_OPERATIONAL_ERROR);
}