1 From: "David J. MacKenzie" <djm@web.us.uu.net>
2 Subject: [Notice] rdist environment limit exceeded
3 To: bugs@linux-mandrake.com
4 Date: Sat, 15 Apr 2000 15:49:01 -0400
9 I hit an arbitrary limit on the environment size in rdist.
10 I used "rdist -P rsh" to get whichever rsh comes first in my PATH (the
11 krb5 rsh, which is in different directories on different machines I use).
12 My environment contains more than 40 variables, and PATH doesn't
13 happen to be among the first 40. Thus, rdist dies with:
15 djm@dagger 35 $ rdist -P rsh -c /var/tmp/services catapult
16 catapult: updating host catapult
17 catapult: LOCAL ERROR: Unexpected input from server: "catapult: LOCAL ERROR: execlp rsh failed: No such file or directory.".
18 catapult: updating of catapult finished
20 because the PATH environment variable is not set any longer.
22 Fix (also sent to the rdist-bugs mailing list):
24 --- src/setargs.c.old Mon Nov 9 23:15:56 1998
25 +++ src/setargs.c Sat Apr 15 15:30:49 2000
27 * Set process argument functions
30 -#define MAXUSERENVIRON 40
32 char *LastArgv = NULL;
33 -char *UserEnviron[MAXUSERENVIRON+1];
37 * Settup things for using setproctitle()
40 extern char **environ;
42 + /* Count the size of the environment. */
43 + for (i = 0; envp[i] != NULL; i++)
46 + UserEnviron = (char **) xmalloc(i * sizeof(char *));
48 /* Remember the User Environment */
50 - for (i = 0; i < MAXUSERENVIRON && envp[i] != NULL; i++)
51 + for (i = 0; envp[i] != NULL; i++)
52 UserEnviron[i] = strdup(envp[i]);
53 UserEnviron[i] = NULL;
54 environ = UserEnviron;