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/shared/install.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/shared/install.c')
-rw-r--r-- | src/shared/install.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 07e06c425f..9722ed4e1c 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -967,14 +967,15 @@ static int config_parse_user(const char *unit, InstallInfo *i = data; char* printed; + int r; assert(filename); assert(lvalue); assert(rvalue); - printed = install_full_printf(i, rvalue); - if (!printed) - return -ENOMEM; + r = install_full_printf(i, rvalue, &printed); + if (r < 0) + return r; free(i->user); i->user = printed; @@ -1200,9 +1201,9 @@ static int install_info_symlink_alias( STRV_FOREACH(s, i->aliases) { _cleanup_free_ char *alias_path = NULL, *dst = NULL; - dst = install_full_printf(i, *s); - if (!dst) - return -ENOMEM; + q = install_full_printf(i, *s, &dst); + if (q < 0) + return q; alias_path = path_make_absolute(dst, config_path); if (!alias_path) @@ -1232,9 +1233,9 @@ static int install_info_symlink_wants( STRV_FOREACH(s, i->wanted_by) { _cleanup_free_ char *path = NULL, *dst = NULL; - dst = install_full_printf(i, *s); - if (!dst) - return -ENOMEM; + q = install_full_printf(i, *s, &dst); + if (q < 0) + return q; if (!unit_name_is_valid(dst, true)) { r = -EINVAL; @@ -1269,9 +1270,9 @@ static int install_info_symlink_requires( STRV_FOREACH(s, i->required_by) { _cleanup_free_ char *path = NULL, *dst = NULL; - dst = install_full_printf(i, *s); - if (!dst) - return -ENOMEM; + q = install_full_printf(i, *s, &dst); + if (q < 0) + return q; if (!unit_name_is_valid(dst, true)) { r = -EINVAL; |