From 3f8f8c27374f72075a30e57011a31c816136a94b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 9 Oct 2019 21:27:39 +0000 Subject: posix-cd: correct stralloc len after canonicalization --- src/posix/posix-cd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/posix/posix-cd.c b/src/posix/posix-cd.c index 49a8430..f825be1 100644 --- a/src/posix/posix-cd.c +++ b/src/posix/posix-cd.c @@ -108,7 +108,8 @@ int main (int argc, char const **argv, char const *const *envp) { stralloc tmp = STRALLOC_ZERO ; if (!stralloc_ready(&tmp, sa.len + 2)) dienomem() ; - if (!path_canonicalize(tmp.s, sa.s, 1)) + tmp.len = path_canonicalize(tmp.s, sa.s, 1) ; + if (!tmp.len++) strerr_diefu4sys(111, "canonicalize ", sa.s, ": problem with ", tmp.s) ; stralloc_free(&sa) ; sa = tmp ; -- cgit v1.2.3