From 0f4743651081b5367ab06f238827ddfd4da74e74 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 22 Oct 2015 19:28:31 +0200 Subject: util-lib: get_current_dir_name() can return errors other than ENOMEM get_current_dir_name() can return a variety of errors, not just ENOMEM, hence don't blindly turn its errors to ENOMEM, but return correct errors in path_make_absolute_cwd(). This trickles down into a couple of other functions, some of which receive unrelated minor fixes too with this commit. --- src/nspawn/nspawn.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/nspawn') diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 99e24cf4ff..056b4ce5f3 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -278,6 +278,7 @@ static int custom_mounts_prepare(void) { static int set_sanitized_path(char **b, const char *path) { char *p; + int r; assert(b); assert(path); @@ -287,9 +288,9 @@ static int set_sanitized_path(char **b, const char *path) { if (errno != ENOENT) return -errno; - p = path_make_absolute_cwd(path); - if (!p) - return -ENOMEM; + r = path_make_absolute_cwd(path, &p); + if (r < 0) + return r; } free(*b); -- cgit v1.2.3-54-g00ecf