Merge remote-tracking branch 'mksh/master'

Conflicts:
    misc.c
This commit is contained in:
KO Myung-Hun 2016-11-12 15:41:31 +09:00
commit 224fd5aebe
2 changed files with 5 additions and 13 deletions

2
exec.c
View File

@ -23,7 +23,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.186 2016/11/11 23:31:34 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.187 2016/11/12 03:54:48 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL #ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh" #define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"

16
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h> #include <grp.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.249 2016/11/11 23:31:35 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/misc.c,v 1.250 2016/11/12 03:54:48 tg Exp $");
#define KSH_CHVT_FLAG #define KSH_CHVT_FLAG
#ifdef MKSH_SMALL #ifdef MKSH_SMALL
@ -1550,15 +1550,11 @@ do_realpath(const char *upath)
/* symlink target is an absolute path */ /* symlink target is an absolute path */
xp = Xstring(xs, xp); xp = Xstring(xs, xp);
beginning_of_a_pathname: beginning_of_a_pathname:
/* assert: (ip == ipath)[0] == '/' */ /* assert: mksh_cdirsep((ip == ipath)[0]) */
/* assert: xp == xs.beg => start of path */ /* assert: xp == xs.beg => start of path */
/* exactly two leading slashes? (SUSv4 3.266) */ /* exactly two leading slashes? (SUSv4 3.266) */
if (ip[1] == '/' && ip[2] != '/' if (ip[1] == ip[0] && !mksh_cdirsep(ip[2])) {
#ifdef __OS2__
|| (mksh_cdirsep(ip[1]) && !mksh_cdirsep(ip[2]))
#endif
) {
/* keep them, e.g. for UNC pathnames */ /* keep them, e.g. for UNC pathnames */
Xput(xs, xp, '/'); Xput(xs, xp, '/');
} }
@ -1727,11 +1723,7 @@ simplify_path(char *p)
case '\\': case '\\':
#endif #endif
/* exactly two leading slashes? (SUSv4 3.266) */ /* exactly two leading slashes? (SUSv4 3.266) */
if (p[1] == '/' && p[2] != '/' if (p[1] == p[0] && !mksh_cdirsep(p[2]))
#ifdef __OS2__
|| (mksh_cdirsep(p[1]) && !mksh_cdirsep(p[2]))
#endif
)
/* keep them, e.g. for UNC pathnames */ /* keep them, e.g. for UNC pathnames */
++p; ++p;
needslash = true; needslash = true;