apply fixes from code review by @komh
This commit is contained in:
parent
34fc7afc8c
commit
0ba04f9bb7
6
misc.c
6
misc.c
@ -32,7 +32,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.285 2017/10/11 23:48:36 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.286 2017/10/12 15:17:03 tg Exp $");
|
||||||
|
|
||||||
#define KSH_CHVT_FLAG
|
#define KSH_CHVT_FLAG
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
@ -1664,7 +1664,7 @@ do_realpath(const char *upath)
|
|||||||
#ifdef MKSH_DOSPATH
|
#ifdef MKSH_DOSPATH
|
||||||
} else if (mksh_drvltr(upath)) {
|
} else if (mksh_drvltr(upath)) {
|
||||||
/* upath is a drive-relative pathname */
|
/* upath is a drive-relative pathname */
|
||||||
if (!getdrvwd(&ldest, ord(*upath)))
|
if (getdrvwd(&ldest, ord(*upath)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
/* A:foo -> A:/cwd/foo; A: -> A:/cwd */
|
/* A:foo -> A:/cwd/foo; A: -> A:/cwd */
|
||||||
ipath = shf_smprintf(Tf_sss, ldest,
|
ipath = shf_smprintf(Tf_sss, ldest,
|
||||||
@ -1783,7 +1783,7 @@ do_realpath(const char *upath)
|
|||||||
#ifdef MKSH_DOSPATH
|
#ifdef MKSH_DOSPATH
|
||||||
/* symlink target might be drive-relative */
|
/* symlink target might be drive-relative */
|
||||||
if (mksh_drvltr(ipath)) {
|
if (mksh_drvltr(ipath)) {
|
||||||
if (!getdrvwd(&ldest, ord(*ipath)))
|
if (getdrvwd(&ldest, ord(*ipath)))
|
||||||
goto notfound;
|
goto notfound;
|
||||||
ip += 2;
|
ip += 2;
|
||||||
goto assemble_symlink;
|
goto assemble_symlink;
|
||||||
|
8
os2.c
8
os2.c
@ -33,7 +33,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/os2.c,v 1.3 2017/10/11 23:23:03 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/os2.c,v 1.4 2017/10/12 15:17:04 tg Exp $");
|
||||||
|
|
||||||
static char *remove_trailing_dots(char *);
|
static char *remove_trailing_dots(char *);
|
||||||
static int access_stat_ex(int (*)(), const char *, void *);
|
static int access_stat_ex(int (*)(), const char *, void *);
|
||||||
@ -564,7 +564,7 @@ cleanup(void)
|
|||||||
int
|
int
|
||||||
getdrvwd(char **cpp, unsigned int drvltr)
|
getdrvwd(char **cpp, unsigned int drvltr)
|
||||||
{
|
{
|
||||||
PBYTE *cp;
|
PBYTE cp;
|
||||||
ULONG sz;
|
ULONG sz;
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
ULONG drvno;
|
ULONG drvno;
|
||||||
@ -578,10 +578,10 @@ getdrvwd(char **cpp, unsigned int drvltr)
|
|||||||
/* allocate 'X:/' plus sz plus NUL */
|
/* allocate 'X:/' plus sz plus NUL */
|
||||||
checkoktoadd((size_t)sz, (size_t)4);
|
checkoktoadd((size_t)sz, (size_t)4);
|
||||||
cp = aresize(*cpp, (size_t)sz + (size_t)4, ATEMP);
|
cp = aresize(*cpp, (size_t)sz + (size_t)4, ATEMP);
|
||||||
cp[0] = drvltr;
|
cp[0] = ksh_toupper(drvltr);
|
||||||
cp[1] = ':';
|
cp[1] = ':';
|
||||||
cp[2] = '/';
|
cp[2] = '/';
|
||||||
drvno = (rtt2asc(drvltr) | 0x20U) - rtt2asc('a') + 1;
|
drvno = ksh_numuc(cp[0]) + 1;
|
||||||
/* NUL is part of space within buffer passed */
|
/* NUL is part of space within buffer passed */
|
||||||
++sz;
|
++sz;
|
||||||
if ((rc = DosQueryCurrentDir(drvno, cp + 3, &sz)) == 0) {
|
if ((rc = DosQueryCurrentDir(drvno, cp + 3, &sz)) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user