summaryrefslogtreecommitdiff
path: root/src/shared/specifier.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-04-11 13:44:41 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-04-11 13:51:28 +0200
commit1c7ec2d2c810e8dba823f2c90ef4230dc820e06c (patch)
tree6cba0aa4fa9c3ba2365e0e3ed38c42e546b43157 /src/shared/specifier.c
parentec7401d0157ed90a4b7807a9fbca305930f2d0ee (diff)
downloadsystemd-1c7ec2d2c810e8dba823f2c90ef4230dc820e06c.tar.gz
shared/specifier: make sure we set the output variable even for void answers
This doesn't change anything for real uses, because we'd initialize the variable to NULL for _cleanup_ anyway, but let's follow our general pattern of always setting the output on "success". (Even if that success is an empty answer here.)
Diffstat (limited to 'src/shared/specifier.c')
-rw-r--r--src/shared/specifier.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/shared/specifier.c b/src/shared/specifier.c
index 16eb8830dc..87b99d38bc 100644
--- a/src/shared/specifier.c
+++ b/src/shared/specifier.c
@@ -276,12 +276,18 @@ int specifier_architecture(char specifier, const void *data, const char *root, c
* installation. */
static int parse_os_release_specifier(const char *root, const char *id, char **ret) {
+ char *v = NULL;
int r;
assert(ret);
+ r = parse_os_release(root, id, &v);
+ if (r >= 0)
+ /* parse_os_release() calls parse_env_file() which only sets the return value for
+ * entries found. Let's make sure we set the return value in all cases. */
+ *ret = v;
+
/* Translate error for missing os-release file to EUNATCH. */
- r = parse_os_release(root, id, ret);
return r == -ENOENT ? -EUNATCH : r;
}