apply fixes from code review by @komh

This commit is contained in:
tg 2017-10-12 15:17:04 +00:00
parent 34fc7afc8c
commit 0ba04f9bb7
2 changed files with 7 additions and 7 deletions

6
misc.c
View File

@ -32,7 +32,7 @@
#include <grp.h>
#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
#ifdef MKSH_SMALL
@ -1664,7 +1664,7 @@ do_realpath(const char *upath)
#ifdef MKSH_DOSPATH
} else if (mksh_drvltr(upath)) {
/* upath is a drive-relative pathname */
if (!getdrvwd(&ldest, ord(*upath)))
if (getdrvwd(&ldest, ord(*upath)))
return (NULL);
/* A:foo -> A:/cwd/foo; A: -> A:/cwd */
ipath = shf_smprintf(Tf_sss, ldest,
@ -1783,7 +1783,7 @@ do_realpath(const char *upath)
#ifdef MKSH_DOSPATH
/* symlink target might be drive-relative */
if (mksh_drvltr(ipath)) {
if (!getdrvwd(&ldest, ord(*ipath)))
if (getdrvwd(&ldest, ord(*ipath)))
goto notfound;
ip += 2;
goto assemble_symlink;

8
os2.c
View File

@ -33,7 +33,7 @@
#include <unistd.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 int access_stat_ex(int (*)(), const char *, void *);
@ -564,7 +564,7 @@ cleanup(void)
int
getdrvwd(char **cpp, unsigned int drvltr)
{
PBYTE *cp;
PBYTE cp;
ULONG sz;
APIRET rc;
ULONG drvno;
@ -578,10 +578,10 @@ getdrvwd(char **cpp, unsigned int drvltr)
/* allocate 'X:/' plus sz plus NUL */
checkoktoadd((size_t)sz, (size_t)4);
cp = aresize(*cpp, (size_t)sz + (size_t)4, ATEMP);
cp[0] = drvltr;
cp[0] = ksh_toupper(drvltr);
cp[1] = ':';
cp[2] = '/';
drvno = (rtt2asc(drvltr) | 0x20U) - rtt2asc('a') + 1;
drvno = ksh_numuc(cp[0]) + 1;
/* NUL is part of space within buffer passed */
++sz;
if ((rc = DosQueryCurrentDir(drvno, cp + 3, &sz)) == 0) {