[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix argument inversion in call to sh_makepath() from sh_realpath

From: Julien Thomas
Subject: [PATCH] Fix argument inversion in call to sh_makepath() from sh_realpath()
Date: Tue, 28 May 2013 00:21:48 +0200

In function sh_realpath() defined in lib/sh/pathphys.c, the arguments
passed to sh_makepath() are inverted. This makes the sh_realpath()
fail when <pathname> is not an absolute path because the expected
concatenation is <wd>/<pathname>, not the reverse.

This problem does not look to be critical, at least in Bash 4.1,
because the function is only used in examples/loadablesrealpath.c.
 lib/sh/pathphys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/sh/pathphys.c b/lib/sh/pathphys.c
index 15fcd25..87fbe64 100644
--- a/lib/sh/pathphys.c
+++ b/lib/sh/pathphys.c
@@ -269,7 +269,7 @@ sh_realpath (pathname, resolved)
       wd = get_working_directory ("sh_realpath");
       if (wd == 0)
        return ((char *)NULL);
-      tdir = sh_makepath ((char *)pathname, wd, 0);
+      tdir = sh_makepath ((const char *)wd, pathname, 0);
       free (wd);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]