From: Paul Smith Date: Sat, 8 Jan 2022 22:31:56 +0000 (-0500) Subject: * src/read.c (tilde_expand): Put back '/' before returning. X-Git-Tag: 4.3.90~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26f4bb89bde6f75bb75aa421b414aca19abdcd67;p=thirdparty%2Fmake.git * src/read.c (tilde_expand): Put back '/' before returning. Joe Filion noted that the string is modified, and Henrik Carlqvist noticed that it wasn't put back in all cases. --- diff --git a/src/read.c b/src/read.c index 65ad694f..e427b76e 100644 --- a/src/read.c +++ b/src/read.c @@ -3044,7 +3044,7 @@ construct_include_path (const char **arg_dirs) char * tilde_expand (const char *name) { -#ifndef VMS +#if !defined(VMS) if (name[1] == '/' || name[1] == '\0') { char *home_dir; @@ -3099,8 +3099,9 @@ tilde_expand (const char *name) { if (userend == 0) return xstrdup (pwent->pw_dir); - else - return xstrdup (concat (3, pwent->pw_dir, "/", userend + 1)); + + *userend = '/'; + return xstrdup (concat (3, pwent->pw_dir, "/", userend + 1)); } else if (userend != 0) *userend = '/';