=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sudo/Attic/sudo_setenv.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/sudo/Attic/sudo_setenv.c 1999/11/18 16:29:01 1.1 --- src/usr.bin/sudo/Attic/sudo_setenv.c 2000/11/21 17:58:44 1.2 *************** *** 59,86 **** #endif /* !STDC_HEADERS */ #ifndef lint ! static const char rcsid[] = "$Sudo: sudo_setenv.c,v 1.40 1999/07/31 16:19:48 millert Exp $"; #endif /* lint */ /* ! * Add a string of the form "var=val" to the environment. If we are unable ! * to expand the current environent, return -1, else return 0. */ ! int sudo_setenv(var, val) char *var; char *val; { #ifdef HAVE_SETENV ! return(setenv(var, val, 1)); #else char *envstring, *tmp; envstring = tmp = (char *) malloc(strlen(var) + strlen(val) + 2); ! if (envstring == NULL) ! return(-1); while ((*tmp++ = *var++)) ; --- 59,91 ---- #endif /* !STDC_HEADERS */ #ifndef lint ! static const char rcsid[] = "$Sudo: sudo_setenv.c,v 1.41 2000/09/14 20:48:58 millert Exp $"; #endif /* lint */ /* ! * Add a string of the form "var=val" to the environment. Exits if it is ! * unable to expand the current environent. */ ! void sudo_setenv(var, val) char *var; char *val; { #ifdef HAVE_SETENV ! if (setenv(var, val, 1) == -1) { ! (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); ! exit(1); ! } #else char *envstring, *tmp; envstring = tmp = (char *) malloc(strlen(var) + strlen(val) + 2); ! if (envstring == NULL) { ! (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); ! exit(1); ! } while ((*tmp++ = *var++)) ; *************** *** 90,95 **** while ((*tmp++ = *val++)) ; ! return(putenv(envstring)); #endif /* HAVE_SETENV */ } --- 95,100 ---- while ((*tmp++ = *val++)) ; ! putenv(envstring); #endif /* HAVE_SETENV */ }