From ad3707d17d40e32f5a740fd8771579b043ec40bd Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 27 Mar 2011 01:30:38 +0000 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20leak=20memory=20(pdksh=20did),?= =?UTF-8?q?=20and=20forgot=20a=20hunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- funcs.c | 6 ++++-- sh.h | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/funcs.c b/funcs.c index 87c3e57..ea28b88 100644 --- a/funcs.c +++ b/funcs.c @@ -38,7 +38,7 @@ #endif #endif -__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.180 2011/03/26 21:46:02 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.181 2011/03/27 01:30:36 tg Exp $"); #if HAVE_KILLPG /* @@ -2700,7 +2700,9 @@ test_eval(Test_env *te, Test_op op, const char *opnd1, const char *opnd2, */ nv = shf_smprintf("%s+", opnd1); - return (stat(nv, &b1) == 0 && S_ISCDF(b1.st_mode)); + i = (stat(nv, &b1) == 0 && S_ISCDF(b1.st_mode)); + afree(nv, ATEMP); + return (i); } #else return (0); diff --git a/sh.h b/sh.h index fe86eff..c7264b8 100644 --- a/sh.h +++ b/sh.h @@ -154,7 +154,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.454 2011/03/26 21:46:06 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.455 2011/03/27 01:30:38 tg Exp $"); #endif #define MKSH_VERSION "R39 2011/03/26" @@ -274,6 +274,9 @@ typedef u_int8_t uint8_t; #ifndef S_ISSOCK #define S_ISSOCK(m) ((m & 0170000) == 0140000) #endif +#if !defined(S_ISCDF) && defined(S_CDF) +#define S_ISCDF(m) (S_ISDIR(m) && ((m) & S_CDF)) +#endif #ifndef DEFFILEMODE #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) #endif