Merge pull request #4510 from keszybz/tree-wide-cleanups
Tree wide cleanups
This commit is contained in:
@@ -106,7 +106,7 @@ static void test_copy_tree(void) {
|
||||
STRV_FOREACH(p, files) {
|
||||
_cleanup_free_ char *f;
|
||||
|
||||
assert_se(f = strappend(original_dir, *p));
|
||||
assert_se((f = strappend(original_dir, *p)));
|
||||
|
||||
assert_se(mkdir_parents(f, 0755) >= 0);
|
||||
assert_se(write_string_file(f, "file", WRITE_STRING_FILE_CREATE) == 0);
|
||||
@@ -115,8 +115,8 @@ static void test_copy_tree(void) {
|
||||
STRV_FOREACH_PAIR(link, p, links) {
|
||||
_cleanup_free_ char *f, *l;
|
||||
|
||||
assert_se(f = strappend(original_dir, *p));
|
||||
assert_se(l = strappend(original_dir, *link));
|
||||
assert_se((f = strappend(original_dir, *p)));
|
||||
assert_se((l = strappend(original_dir, *link)));
|
||||
|
||||
assert_se(mkdir_parents(l, 0755) >= 0);
|
||||
assert_se(symlink(f, l) == 0);
|
||||
@@ -131,7 +131,7 @@ static void test_copy_tree(void) {
|
||||
_cleanup_free_ char *buf = NULL, *f;
|
||||
size_t sz = 0;
|
||||
|
||||
assert_se(f = strappend(copy_dir, *p));
|
||||
assert_se((f = strappend(copy_dir, *p)));
|
||||
|
||||
assert_se(access(f, F_OK) == 0);
|
||||
assert_se(read_full_file(f, &buf, &sz) == 0);
|
||||
@@ -141,8 +141,8 @@ static void test_copy_tree(void) {
|
||||
STRV_FOREACH_PAIR(link, p, links) {
|
||||
_cleanup_free_ char *target = NULL, *f, *l;
|
||||
|
||||
assert_se(f = strjoin(original_dir, *p, NULL));
|
||||
assert_se(l = strjoin(copy_dir, *link, NULL));
|
||||
assert_se((f = strjoin(original_dir, *p)));
|
||||
assert_se((l = strjoin(copy_dir, *link)));
|
||||
|
||||
assert_se(readlink_and_canonicalize(l, &target) == 0);
|
||||
assert_se(path_equal(f, target));
|
||||
|
||||
@@ -60,7 +60,7 @@ static void test_one(const char *p) {
|
||||
_cleanup_free_ char *with_utc;
|
||||
|
||||
log_info("Test: %s", p);
|
||||
with_utc = strjoin(p, " UTC", NULL);
|
||||
with_utc = strjoin(p, " UTC");
|
||||
test_should_pass(p);
|
||||
test_should_pass(with_utc);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ static void test_one_noutc(const char *p) {
|
||||
_cleanup_free_ char *with_utc;
|
||||
|
||||
log_info("Test: %s", p);
|
||||
with_utc = strjoin(p, " UTC", NULL);
|
||||
with_utc = strjoin(p, " UTC");
|
||||
test_should_pass(p);
|
||||
test_should_fail(with_utc);
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ static void test_write_string_file_verify(void) {
|
||||
int r;
|
||||
|
||||
assert_se(read_one_line_file("/proc/cmdline", &buf) >= 0);
|
||||
assert_se((buf2 = strjoin(buf, "\n", NULL)));
|
||||
assert_se((buf2 = strjoin(buf, "\n")));
|
||||
|
||||
r = write_string_file("/proc/cmdline", buf, 0);
|
||||
assert_se(r == -EACCES || r == -EIO);
|
||||
|
||||
@@ -132,14 +132,14 @@ int main(int argc, char *argv[]) {
|
||||
assert_se(sd_id128_get_boot(&bid) >= 0);
|
||||
sd_id128_to_string(bid, boot_id);
|
||||
|
||||
x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
|
||||
y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-", NULL);
|
||||
x = strjoin("/tmp/systemd-private-", boot_id, "-abcd.service-");
|
||||
y = strjoin("/var/tmp/systemd-private-", boot_id, "-abcd.service-");
|
||||
assert_se(x && y);
|
||||
|
||||
test_tmpdir("abcd.service", x, y);
|
||||
|
||||
z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
|
||||
zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-", NULL);
|
||||
z = strjoin("/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
|
||||
zz = strjoin("/var/tmp/systemd-private-", boot_id, "-sys-devices-pci0000:00-0000:00:1a.0-usb3-3\\x2d1-3\\x2d1:1.0-bluetooth-hci0.device-");
|
||||
|
||||
assert_se(z && zz);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static int setup_test(Manager **m) {
|
||||
STRV_FOREACH(test_path, tests_path) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = strjoin("/tmp/test-path_", *test_path, NULL);
|
||||
p = strjoin("/tmp/test-path_", *test_path);
|
||||
assert_se(p);
|
||||
|
||||
(void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "util.h"
|
||||
|
||||
static char *lookup(const char *variable, void *userdata) {
|
||||
return strjoin("<<<", variable, ">>>", NULL);
|
||||
return strjoin("<<<", variable, ">>>");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
Reference in New Issue
Block a user