diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-09-17 10:03:46 -0500 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-09-17 10:06:50 -0500 |
commit | 19f6d710772305610b928bc2678b9d77fe11e770 (patch) | |
tree | ca3e7b4f7f20f94137fcef96b92a7a208c72e1c5 /src/test/test-unit-name.c | |
parent | 0aafd43d235982510d1c40564079f7bcec0c7c19 (diff) |
specifier: rework specifier calls to return proper error message
Previously the specifier calls could only indicate OOM by returning
NULL. With this change they will return negative errno-style error codes
like everything else.
Diffstat (limited to 'src/test/test-unit-name.c')
-rw-r--r-- | src/test/test-unit-name.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c index c17692b845..67ccdd4228 100644 --- a/src/test/test-unit-name.c +++ b/src/test/test-unit-name.c @@ -117,8 +117,8 @@ static int test_unit_printf(void) { _cleanup_free_ char *mid, *bid, *host, *root_uid; struct passwd *root; - assert_se((mid = specifier_machine_id('m', NULL, NULL))); - assert_se((bid = specifier_boot_id('b', NULL, NULL))); + assert_se(specifier_machine_id('m', NULL, NULL, &mid) >= 0 && mid); + assert_se(specifier_boot_id('b', NULL, NULL, &bid) >= 0 && bid); assert_se((host = gethostname_malloc())); assert_se((root = getpwnam("root"))); @@ -134,8 +134,8 @@ static int test_unit_printf(void) { #define expect(unit, pattern, expected) \ { \ char *e; \ - _cleanup_free_ char *t = \ - unit_full_printf(unit, pattern); \ + _cleanup_free_ char *t; \ + assert_se(unit_full_printf(unit, pattern, &t) >= 0); \ printf("result: %s\nexpect: %s\n", t, expected); \ if ((e = endswith(expected, "*"))) \ assert(strncmp(t, e, e-expected)); \ |