• unify ksh_dup2() usage, use bool where appropriate
• apply diff from mirbsdksh-1.11: #ifdef DUP2_BROKEN /* Ultrix systems like to preserve the close-on-exec flag */ ‣ XXX we do #ifdef __ultrix here (imake-style) instead of mirtoconfing it (but does anyone know of any other OS with the same problem? plus we’d see it as we now know the symptoms) • remove ultrix Build.hs warn=' but might work…' in the hope it DOES
This commit is contained in:
parent
47a7d246ca
commit
e8d61a1d99
4
Build.sh
4
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.311 2008/04/01 17:25:36 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.312 2008/04/01 20:40:20 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
||||||
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
||||||
@ -342,8 +342,6 @@ syllable)
|
|||||||
ULTRIX)
|
ULTRIX)
|
||||||
: ${CC=cc -YPOSIX}
|
: ${CC=cc -YPOSIX}
|
||||||
CPPFLAGS="$CPPFLAGS -Dssize_t=int"
|
CPPFLAGS="$CPPFLAGS -Dssize_t=int"
|
||||||
warn=' but might work. I think that I/O'
|
|
||||||
warn="$warn${nl}redirs are kaput: child affects parent"
|
|
||||||
;;
|
;;
|
||||||
UWIN*)
|
UWIN*)
|
||||||
ccpc='-Yc,'
|
ccpc='-Yc,'
|
||||||
|
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.169 2008/04/01 17:25:37 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.170 2008/04/01 20:40:21 tg Exp $
|
||||||
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
|
||||||
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R33 2008/03/28
|
@(#)MIRBSD KSH R33 2008/04/01
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
category: pdksh
|
category: pdksh
|
||||||
|
6
exec.c
6
exec.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.39 2007/10/25 13:27:00 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.40 2008/04/01 20:40:21 tg Exp $");
|
||||||
|
|
||||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||||
int volatile);
|
int volatile);
|
||||||
@ -109,14 +109,14 @@ execute(struct op *volatile t,
|
|||||||
e->savefd[1] = savefd(1);
|
e->savefd[1] = savefd(1);
|
||||||
while (t->type == TPIPE) {
|
while (t->type == TPIPE) {
|
||||||
openpipe(pv);
|
openpipe(pv);
|
||||||
(void) ksh_dup2(pv[1], 1, false); /* stdout of curr */
|
ksh_dup2(pv[1], 1, false); /* stdout of curr */
|
||||||
/* Let exchild() close pv[0] in child
|
/* Let exchild() close pv[0] in child
|
||||||
* (if this isn't done, commands like
|
* (if this isn't done, commands like
|
||||||
* (: ; cat /etc/termcap) | sleep 1
|
* (: ; cat /etc/termcap) | sleep 1
|
||||||
* will hang forever).
|
* will hang forever).
|
||||||
*/
|
*/
|
||||||
exchild(t->left, flags|XPIPEO|XCCLOSE, pv[0]);
|
exchild(t->left, flags|XPIPEO|XCCLOSE, pv[0]);
|
||||||
(void) ksh_dup2(pv[0], 0, false); /* stdin of next */
|
ksh_dup2(pv[0], 0, false); /* stdin of next */
|
||||||
closepipe(pv);
|
closepipe(pv);
|
||||||
flags |= XPIPEI;
|
flags |= XPIPEI;
|
||||||
t = t->right;
|
t = t->right;
|
||||||
|
15
main.c
15
main.c
@ -13,7 +13,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.94 2008/03/28 18:47:52 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.95 2008/04/01 20:40:21 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -922,14 +922,19 @@ initio(void)
|
|||||||
|
|
||||||
/* A dup2() with error checking */
|
/* A dup2() with error checking */
|
||||||
int
|
int
|
||||||
ksh_dup2(int ofd, int nfd, int errok)
|
ksh_dup2(int ofd, int nfd, bool errok)
|
||||||
{
|
{
|
||||||
int ret = dup2(ofd, nfd);
|
int rv;
|
||||||
|
|
||||||
if (ret < 0 && errno != EBADF && !errok)
|
if (((rv = dup2(ofd, nfd)) < 0) && !errok && (errno != EBADF))
|
||||||
errorf("too many files open in shell");
|
errorf("too many files open in shell");
|
||||||
|
|
||||||
return ret;
|
#ifdef __ultrix
|
||||||
|
if (rv >= 0)
|
||||||
|
fcntl(nfd, F_SETFD, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
8
misc.c
8
misc.c
@ -6,7 +6,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.69 2008/03/23 22:09:58 tg Exp $\t"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.70 2008/04/01 20:40:22 tg Exp $\t"
|
||||||
MKSH_SH_H_ID);
|
MKSH_SH_H_ID);
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
@ -1380,9 +1380,9 @@ chvt(const char *fn)
|
|||||||
errorf("chvt: setsid failed");
|
errorf("chvt: setsid failed");
|
||||||
if ((fn != dv + 1) && ioctl(fd, TIOCSCTTY, NULL) == -1)
|
if ((fn != dv + 1) && ioctl(fd, TIOCSCTTY, NULL) == -1)
|
||||||
errorf("chvt: TIOCSCTTY failed");
|
errorf("chvt: TIOCSCTTY failed");
|
||||||
dup2(fd, 0);
|
ksh_dup2(fd, 0, false);
|
||||||
dup2(fd, 1);
|
ksh_dup2(fd, 1, false);
|
||||||
dup2(fd, 2);
|
ksh_dup2(fd, 2, false);
|
||||||
if (fd > 2)
|
if (fd > 2)
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
6
sh.h
6
sh.h
@ -8,8 +8,8 @@
|
|||||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||||
|
|
||||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.199 2008/03/28 13:46:53 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.200 2008/04/01 20:40:22 tg Exp $"
|
||||||
#define MKSH_VERSION "R33 2008/03/28"
|
#define MKSH_VERSION "R33 2008/04/01"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -1384,7 +1384,7 @@ void shprintf(const char *, ...)
|
|||||||
__attribute__((format (printf, 1, 2)));
|
__attribute__((format (printf, 1, 2)));
|
||||||
int can_seek(int);
|
int can_seek(int);
|
||||||
void initio(void);
|
void initio(void);
|
||||||
int ksh_dup2(int, int, int);
|
int ksh_dup2(int, int, bool);
|
||||||
short savefd(int);
|
short savefd(int);
|
||||||
void restfd(int, int);
|
void restfd(int, int);
|
||||||
void openpipe(int *);
|
void openpipe(int *);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user