]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* src/read.c (tilde_expand): Put back '/' before returning.
authorPaul Smith <psmith@gnu.org>
Sat, 8 Jan 2022 22:31:56 +0000 (17:31 -0500)
committerPaul Smith <psmith@gnu.org>
Mon, 17 Jan 2022 23:38:32 +0000 (18:38 -0500)
Joe Filion <joefilion4@gmail.com> noted that the string is modified,
and Henrik Carlqvist <hc94@poolhem.se> noticed that it wasn't put
back in all cases.

src/read.c

index 65ad694fdfc98efe5f71096824cd3f7dccf2c5bd..e427b76e487e62e278bf5b409f12409f69879ce4 100644 (file)
@@ -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 = '/';