fix a number of warnings and other issues:
• sig_t detection was a bit insane, it is a function-pointer type after all • fix uninitialised variable in c_select which led to mistakenly accepting invalid (nōn-numeric) input and acting, randomly, upon it • keep SIGCHLD blocked in child after forking longer, for job list manip • block SIGCHLD ifdef DEBUG_LEAKS to not run job foo during/after afreeall • fix annoying ISO C90 vs. C99 (un)signed constant warning
This commit is contained in:
parent
d16705415a
commit
8256f266ff
16
Build.sh
16
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.636 2013/05/31 23:27:11 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.637 2013/06/02 03:09:11 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013
|
# 2011, 2012, 2013
|
||||||
@ -1500,14 +1500,18 @@ ac_testn sig_t <<-'EOF'
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
int main(void) { return ((int)(ptrdiff_t)(sig_t)(ptrdiff_t)kill(0,0)); }
|
#include <stdlib.h>
|
||||||
|
volatile sig_t foo = NULL;
|
||||||
|
int main(void) { return (foo == NULL); }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
ac_testn sighandler_t '!' sig_t 0 <<-'EOF'
|
ac_testn sighandler_t '!' sig_t 0 <<-'EOF'
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
int main(void) { return ((int)(ptrdiff_t)(sighandler_t)(ptrdiff_t)kill(0,0)); }
|
#include <stdlib.h>
|
||||||
|
volatile sighandler_t foo = NULL;
|
||||||
|
int main(void) { return (foo == NULL); }
|
||||||
EOF
|
EOF
|
||||||
if test 1 = $HAVE_SIGHANDLER_T; then
|
if test 1 = $HAVE_SIGHANDLER_T; then
|
||||||
add_cppflags -Dsig_t=sighandler_t
|
add_cppflags -Dsig_t=sighandler_t
|
||||||
@ -1518,7 +1522,9 @@ ac_testn __sighandler_t '!' sig_t 0 <<-'EOF'
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
int main(void) { return ((int)(ptrdiff_t)(__sighandler_t)(ptrdiff_t)kill(0,0)); }
|
#include <stdlib.h>
|
||||||
|
volatile __sighandler_t foo = NULL;
|
||||||
|
int main(void) { return (foo == NULL); }
|
||||||
EOF
|
EOF
|
||||||
if test 1 = $HAVE___SIGHANDLER_T; then
|
if test 1 = $HAVE___SIGHANDLER_T; then
|
||||||
add_cppflags -Dsig_t=__sighandler_t
|
add_cppflags -Dsig_t=__sighandler_t
|
||||||
@ -1541,7 +1547,7 @@ else
|
|||||||
#define EXTERN
|
#define EXTERN
|
||||||
#define MKSH_INCLUDES_ONLY
|
#define MKSH_INCLUDES_ONLY
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.636 2013/05/31 23:27:11 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.637 2013/06/02 03:09:11 tg Exp $");
|
||||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||||
EOF
|
EOF
|
||||||
case $cm in
|
case $cm in
|
||||||
|
6
check.t
6
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.614 2013/06/01 00:15:55 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.615 2013/06/02 03:09:12 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 $
|
||||||
@ -29,7 +29,7 @@
|
|||||||
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R46 2013/05/31
|
@(#)MIRBSD KSH R46 2013/06/01
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
@ -38,7 +38,7 @@ name: KSH_VERSION
|
|||||||
category: shell:legacy-no
|
category: shell:legacy-no
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R46 2013/05/31
|
@(#)LEGACY KSH R46 2013/06/01
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
|
6
exec.c
6
exec.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.120 2013/04/26 21:22:44 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.121 2013/06/02 03:09:14 tg Exp $");
|
||||||
|
|
||||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||||
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
|
||||||
@ -1561,10 +1561,8 @@ do_selectargs(const char **ap, bool print_menu)
|
|||||||
if (call_builtin(findcom("read", FC_BI), read_args, Tselect))
|
if (call_builtin(findcom("read", FC_BI), read_args, Tselect))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
s = str_val(global("REPLY"));
|
s = str_val(global("REPLY"));
|
||||||
if (*s) {
|
if (*s && getn(s, &i))
|
||||||
getn(s, &i);
|
|
||||||
return ((i >= 1 && i <= argct) ? ap[i - 1] : null);
|
return ((i >= 1 && i <= argct) ? ap[i - 1] : null);
|
||||||
}
|
|
||||||
print_menu = true;
|
print_menu = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
jobs.c
9
jobs.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.98 2013/06/01 20:34:01 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.99 2013/06/02 03:09:15 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
#define mksh_killpg killpg
|
#define mksh_killpg killpg
|
||||||
@ -503,9 +503,6 @@ exchild(struct op *t, int flags,
|
|||||||
/* Do this before restoring signal */
|
/* Do this before restoring signal */
|
||||||
if (flags & XCOPROC)
|
if (flags & XCOPROC)
|
||||||
coproc_cleanup(false);
|
coproc_cleanup(false);
|
||||||
#ifndef MKSH_NOPROSPECTOFWORK
|
|
||||||
sigprocmask(SIG_SETMASK, &omask, NULL);
|
|
||||||
#endif
|
|
||||||
cleanup_parents_env();
|
cleanup_parents_env();
|
||||||
#ifndef MKSH_UNEMPLOYED
|
#ifndef MKSH_UNEMPLOYED
|
||||||
/*
|
/*
|
||||||
@ -540,6 +537,10 @@ exchild(struct op *t, int flags,
|
|||||||
}
|
}
|
||||||
/* in case of $(jobs) command */
|
/* in case of $(jobs) command */
|
||||||
remove_job(j, "child");
|
remove_job(j, "child");
|
||||||
|
#ifndef MKSH_NOPROSPECTOFWORK
|
||||||
|
/* remove_job needs SIGCHLD blocked still */
|
||||||
|
sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
|
#endif
|
||||||
nzombie = 0;
|
nzombie = 0;
|
||||||
#ifndef MKSH_UNEMPLOYED
|
#ifndef MKSH_UNEMPLOYED
|
||||||
ttypgrp_ok = false;
|
ttypgrp_ok = false;
|
||||||
|
8
main.c
8
main.c
@ -34,7 +34,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.264 2013/05/02 20:21:43 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.265 2013/06/02 03:09:16 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||||||
xc = 0;
|
xc = 0;
|
||||||
--xc;
|
--xc;
|
||||||
if ((xua2 != 2147483648UL) ||
|
if ((xua2 != 2147483648UL) ||
|
||||||
(xl != -2147483648L) || (xul != 2147483648UL) ||
|
(xl != (-2147483647L-1)) || (xul != 2147483648UL) ||
|
||||||
(xi != -1) || (xui != 4294967295U) ||
|
(xi != -1) || (xui != 4294967295U) ||
|
||||||
(xa != 0) || (xua != 0) || (xc != 255))
|
(xa != 0) || (xua != 0) || (xc != 255))
|
||||||
errorf("integer wraparound test failed");
|
errorf("integer wraparound test failed");
|
||||||
@ -1014,6 +1014,10 @@ quitenv(struct shf *shf)
|
|||||||
#ifdef DEBUG_LEAKS
|
#ifdef DEBUG_LEAKS
|
||||||
#ifndef MKSH_NO_CMDLINE_EDITING
|
#ifndef MKSH_NO_CMDLINE_EDITING
|
||||||
x_done();
|
x_done();
|
||||||
|
#endif
|
||||||
|
#ifndef MKSH_NOPROSPECTOFWORK
|
||||||
|
/* block at least SIGCHLD during/after afreeall */
|
||||||
|
sigprocmask(SIG_BLOCK, &sm_sigchld, NULL);
|
||||||
#endif
|
#endif
|
||||||
afreeall(APERM);
|
afreeall(APERM);
|
||||||
for (fd = 3; fd < NUFILE; fd++)
|
for (fd = 3; fd < NUFILE; fd++)
|
||||||
|
4
sh.h
4
sh.h
@ -164,9 +164,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.657 2013/06/01 00:15:58 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.658 2013/06/02 03:09:17 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R46 2013/05/31"
|
#define MKSH_VERSION "R46 2013/06/01"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user