1
0
mirror of https://github.com/systemd/systemd synced 2025-12-27 03:14:46 +01:00

Compare commits

..

No commits in common. "3b493d94ae78efcab4caa3678ed160a05cb2d527" and "26a63b81322a3bd8b9fbd43f75897c391708de2c" have entirely different histories.

13 changed files with 18 additions and 22 deletions

View File

@ -274,8 +274,7 @@ static int create_disk(
const char *device, const char *device,
const char *password, const char *password,
const char *keydev, const char *keydev,
const char *options, const char *options) {
const char *source) {
_cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL, _cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
*keydev_mount = NULL, *keyfile_timeout_value = NULL, *keydev_mount = NULL, *keyfile_timeout_value = NULL,
@ -344,7 +343,7 @@ static int create_disk(
if (r < 0) if (r < 0)
return r; return r;
r = generator_write_cryptsetup_unit_section(f, source); r = generator_write_cryptsetup_unit_section(f, arg_crypttab);
if (r < 0) if (r < 0)
return r; return r;
@ -541,7 +540,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (proc_cmdline_value_missing(key, value)) if (proc_cmdline_value_missing(key, value))
return 0; return 0;
d = get_crypto_device(startswith(value, "luks-") ?: value); d = get_crypto_device(startswith(value, "luks-") ? value+5 : value);
if (!d) if (!d)
return log_oom(); return log_oom();
@ -681,7 +680,7 @@ static int add_crypttab_devices(void) {
if (r < 0) if (r < 0)
return r; return r;
r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options, arg_crypttab); r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options);
if (r < 0) if (r < 0)
return r; return r;
@ -716,8 +715,7 @@ static int add_proc_cmdline_devices(void) {
device, device,
d->keyfile ?: arg_default_keyfile, d->keyfile ?: arg_default_keyfile,
d->keydev, d->keydev,
d->options ?: arg_default_options, d->options ?: arg_default_options);
"/proc/cmdline");
if (r < 0) if (r < 0)
return r; return r;
} }

View File

@ -176,7 +176,7 @@ int loop_device_make(
.fd = fd, .fd = fd,
.info = { .info = {
/* Use the specified flags, but configure the read-only flag from the open flags, and force autoclear */ /* Use the specified flags, but configure the read-only flag from the open flags, and force autoclear */
.lo_flags = (loop_flags & ~LO_FLAGS_READ_ONLY) | ((open_flags & O_ACCMODE) == O_RDONLY ? LO_FLAGS_READ_ONLY : 0) | LO_FLAGS_AUTOCLEAR, .lo_flags = (loop_flags & ~LO_FLAGS_READ_ONLY) | ((loop_flags & O_ACCMODE) == O_RDONLY ? LO_FLAGS_READ_ONLY : 0) | LO_FLAGS_AUTOCLEAR,
.lo_offset = offset, .lo_offset = offset,
.lo_sizelimit = size == UINT64_MAX ? 0 : size, .lo_sizelimit = size == UINT64_MAX ? 0 : size,
}, },
@ -198,7 +198,7 @@ int loop_device_make(
if (loop < 0) { if (loop < 0) {
/* Somebody might've gotten the same number from the kernel, used the device, /* Somebody might've gotten the same number from the kernel, used the device,
* and called LOOP_CTL_REMOVE on it. Let's retry with a new number. */ * and called LOOP_CTL_REMOVE on it. Let's retry with a new number. */
if (!IN_SET(errno, ENOENT, ENXIO)) if (errno != ENOENT)
return -errno; return -errno;
} else { } else {
r = loop_configure(loop, &config); r = loop_configure(loop, &config);

View File

@ -644,8 +644,8 @@ int mount_verbose_full(
log_debug("Moving mount %s → %s (%s \"%s\")...", log_debug("Moving mount %s → %s (%s \"%s\")...",
what, where, strnull(fl), strempty(o)); what, where, strnull(fl), strempty(o));
else else
log_debug("Mounting %s (%s) on %s (%s \"%s\")...", log_debug("Mounting %s on %s (%s \"%s\")...",
strna(what), strna(type), where, strnull(fl), strempty(o)); strna(type), where, strnull(fl), strempty(o));
if (follow_symlink) if (follow_symlink)
r = mount(what, where, type, f, o) < 0 ? -errno : 0; r = mount(what, where, type, f, o) < 0 ? -errno : 0;

View File

@ -318,7 +318,7 @@ static void test_protect_sysctl(void) {
if (pid == 0) { if (pid == 0) {
#if defined __NR__sysctl && __NR__sysctl >= 0 #if defined __NR__sysctl && __NR__sysctl >= 0
assert_se(syscall(__NR__sysctl, NULL) < 0); assert_se(syscall(__NR__sysctl, NULL) < 0);
assert_se(IN_SET(errno, EFAULT, ENOSYS)); assert_se(errno == EFAULT);
#endif #endif
assert_se(seccomp_protect_sysctl() >= 0); assert_se(seccomp_protect_sysctl() >= 0);

View File

@ -76,4 +76,4 @@ test_setup_cleanup() {
cleanup_initdir cleanup_initdir
} }
do_test "$@" 24 do_test "$@" 02

View File

@ -60,4 +60,4 @@ check_result_qemu() {
return $_ret return $_ret
} }
do_test "$@" 02 do_test "$@" 24

View File

@ -7,7 +7,7 @@ if [ $# -gt 0 ]; then
else else
args="setup run clean-again" args="setup run clean-again"
fi fi
args_no_clean=$(sed -r 's/\bclean\b//g' <<<$args) args_no_clean=$(sed -r 's/(^| )clean($| )/ /g' <<<$args)
do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? ) do_clean=$( [ "$args" = "$args_no_clean" ]; echo $? )
ninja -C "$BUILD_DIR" ninja -C "$BUILD_DIR"
@ -26,8 +26,6 @@ if [ $do_clean = 1 ]; then
for TEST in TEST-??-* ; do for TEST in TEST-??-* ; do
( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean ) ( set -x ; make -C "$TEST" "BUILD_DIR=$BUILD_DIR" clean )
done done
[ -n "$args_no_clean" ] || exit 0
fi fi
pass_blacklist() { pass_blacklist() {

View File

@ -1,7 +1,8 @@
[Unit] [Unit]
Description=TEST-02-UNITTESTS Description=TEST-02-CRYPTSETUP
After=multi-user.target
[Service] [Service]
ExecStartPre=rm -f /failed /testok ExecStartPre=rm -f /failed /testok
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh ExecStart=sh -x -e -c 'mountpoint /var; systemctl --state=failed --no-legend --no-pager >/failed; echo OK >/testok'
Type=oneshot Type=oneshot

View File

@ -1,8 +1,7 @@
[Unit] [Unit]
Description=TEST-24-CRYPTSETUP Description=TEST-24-UNIT-TESTS
After=multi-user.target
[Service] [Service]
ExecStartPre=rm -f /failed /testok ExecStartPre=rm -f /failed /testok
ExecStart=sh -x -e -c 'mountpoint /var; systemctl --state=failed --no-legend --no-pager >/failed; echo OK >/testok' ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
Type=oneshot Type=oneshot