blob: c0a710a90a9cedfea279ccaea8c320c883af7921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
Fix `internal error: j_async: bad nzombie (0)' that occured with `sudo pdksh -c "sleep 10&"'
Sudo sets RLIMIT_NPROC to unlimited, and sysconf returns that value as -1.
Index: pdksh-5.2.14/jobs.c
===================================================================
--- pdksh-5.2.14.orig/jobs.c 2008-05-26 21:46:41.000000000 +0200
+++ pdksh-5.2.14/jobs.c 2008-05-26 21:56:12.000000000 +0200
@@ -174,9 +174,9 @@
static Job *async_job;
static pid_t async_pid;
-static int nzombie; /* # of zombies owned by this process */
+static long nzombie; /* # of zombies owned by this process */
static INT32 njobs; /* # of jobs started */
-static int child_max; /* CHILD_MAX */
+static long child_max; /* CHILD_MAX */
#ifdef JOB_SIGS
@@ -227,6 +227,12 @@
int mflagset;
{
child_max = CHILD_MAX; /* so syscon() isn't always being called */
+#if defined(HAVE_SYSCONF) && defined(_SC_CHILD_MAX)
+ if (child_max < 0) {
+ child_max = LONG_MAX;
+ }
+#endif
+
#ifdef JOB_SIGS
sigemptyset(&sm_default);
@@ -1131,7 +1137,7 @@
if (!oldest) {
/* XXX debugging */
if (!(async_job->flags & JF_ZOMBIE) || nzombie != 1) {
- internal_errorf(0, "j_async: bad nzombie (%d)", nzombie);
+ internal_errorf(0, "j_async: bad nzombie (%ld)", nzombie);
nzombie = 0;
}
break;
|