• 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
|
||||
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
|
||||
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
|
||||
@ -342,8 +342,6 @@ syllable)
|
||||
ULTRIX)
|
||||
: ${CC=cc -YPOSIX}
|
||||
CPPFLAGS="$CPPFLAGS -Dssize_t=int"
|
||||
warn=' but might work. I think that I/O'
|
||||
warn="$warn${nl}redirs are kaput: child affects parent"
|
||||
;;
|
||||
UWIN*)
|
||||
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: 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 $
|
||||
@ -7,7 +7,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R33 2008/03/28
|
||||
@(#)MIRBSD KSH R33 2008/04/01
|
||||
description:
|
||||
Check version of shell.
|
||||
category: pdksh
|
||||
|
6
exec.c
6
exec.c
@ -2,7 +2,7 @@
|
||||
|
||||
#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 **,
|
||||
int volatile);
|
||||
@ -109,14 +109,14 @@ execute(struct op *volatile t,
|
||||
e->savefd[1] = savefd(1);
|
||||
while (t->type == TPIPE) {
|
||||
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
|
||||
* (if this isn't done, commands like
|
||||
* (: ; cat /etc/termcap) | sleep 1
|
||||
* will hang forever).
|
||||
*/
|
||||
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);
|
||||
flags |= XPIPEI;
|
||||
t = t->right;
|
||||
|
15
main.c
15
main.c
@ -13,7 +13,7 @@
|
||||
#include <locale.h>
|
||||
#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;
|
||||
|
||||
@ -922,14 +922,19 @@ initio(void)
|
||||
|
||||
/* A dup2() with error checking */
|
||||
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");
|
||||
|
||||
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>
|
||||
#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);
|
||||
|
||||
#undef USE_CHVT
|
||||
@ -1380,9 +1380,9 @@ chvt(const char *fn)
|
||||
errorf("chvt: setsid failed");
|
||||
if ((fn != dv + 1) && ioctl(fd, TIOCSCTTY, NULL) == -1)
|
||||
errorf("chvt: TIOCSCTTY failed");
|
||||
dup2(fd, 0);
|
||||
dup2(fd, 1);
|
||||
dup2(fd, 2);
|
||||
ksh_dup2(fd, 0, false);
|
||||
ksh_dup2(fd, 1, false);
|
||||
ksh_dup2(fd, 2, false);
|
||||
if (fd > 2)
|
||||
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: 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_VERSION "R33 2008/03/28"
|
||||
#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/04/01"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@ -1384,7 +1384,7 @@ void shprintf(const char *, ...)
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
int can_seek(int);
|
||||
void initio(void);
|
||||
int ksh_dup2(int, int, int);
|
||||
int ksh_dup2(int, int, bool);
|
||||
short savefd(int);
|
||||
void restfd(int, int);
|
||||
void openpipe(int *);
|
||||
|
Loading…
Reference in New Issue
Block a user