Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

"unset USERNAME" fix



-----BEGIN PGP SIGNED MESSAGE-----

If one does "unset USERNAME", zsh dumps core.  This fixes it, at least
to the point where it no longer crashes.  (zsh's handling of special
parameters needs a serious overhaul.)  It is now possible to clear the
environment by doing "unset -m \*".

 -zefram

      Index: Src/params.c
      *** params.c	1996/05/30 14:18:48	1.5
      --- params.c	1996/06/04 13:17:18
      ***************
      *** 689,696 ****
            return s;
        }
        
      ! static char *nular[] =
      ! {"", NULL};
        
        /**/
        char **
      --- 689,695 ----
            return s;
        }
        
      ! static char *nular[] = {"", NULL};
        
        /**/
        char **
      ***************
      *** 1068,1076 ****
            case PM_SCALAR:
        	(pm->sets.cfn) (pm, NULL);
        	break;
      -     case PM_INTEGER:
      - 	(pm->sets.ifn) (pm, 0);
      - 	break;
            case PM_ARRAY:
        	(pm->sets.afn) (pm, NULL);
        	break;
      --- 1067,1072 ----
      ***************
      *** 1433,1439 ****
        #ifdef HAVE_SETUID
            struct passwd *pswd;
        
      !     if ((pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
        	if(!setgid(pswd->pw_gid) && !setuid(pswd->pw_uid)) {
        	    zsfree(cached_username);
        	    cached_username = ztrdup(pswd->pw_name);
      --- 1429,1435 ----
        #ifdef HAVE_SETUID
            struct passwd *pswd;
        
      !     if (x && (pswd = getpwnam(x)) && (pswd->pw_uid != cached_uid)) {
        	if(!setgid(pswd->pw_gid) && !setuid(pswd->pw_uid)) {
        	    zsfree(cached_username);
        	    cached_username = ztrdup(pswd->pw_name);
      ***************
      *** 1640,1647 ****
        	hatchar = (bangchar) ? x[1] : '\0';
        	hashchar = (hatchar) ? x[2] : '\0';
        	zsfree(x);
      !     }
      !     else {
        	bangchar = '!';
        	hashchar = '#';
        	hatchar = '^';
      --- 1636,1642 ----
        	hatchar = (bangchar) ? x[1] : '\0';
        	hashchar = (hatchar) ? x[2] : '\0';
        	zsfree(x);
      !     } else {
        	bangchar = '!';
        	hashchar = '#';
        	hatchar = '^';

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMbQ5aXD/+HJTpU/hAQHiugP9EmroqUq/gxc4O0WY09PgqnZEIJ3qySAu
vM4KB3bbpNt6oPsrZSv6/NlichmETjKkETQ3ekW3J8La/YSuBBtAZnBvvgLD/rB9
7u9FDyTXpKi2N59PJsM8RkjuX4tuGYCykiGNUOM0ywCRWge4vK2Z3t2HfQJU4W11
7VM/U060Xtw=
=iN6w
-----END PGP SIGNATURE-----




Messages sorted by: Reverse Date, Date, Thread, Author