made handling of "mailname" global variable simpler -- now it
authorKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Fri, 25 Jun 1982 14:53:28 +0000 (06:53 -0800)
committerKurt A. Shoens <kurt@ucbvax.Berkeley.EDU>
Fri, 25 Jun 1982 14:53:28 +0000 (06:53 -0800)
is an array of chars rather than a pointer that used to get set to a small
calloc'd space that would get clobbered if you changed to a longer name.

SCCS-vsn: usr.bin/mail/main.c 2.7

usr/src/usr.bin/mail/main.c

index 7e49b49..4b71ff2 100644 (file)
@@ -9,7 +9,7 @@
  * Startup -- interface with user.
  */
 
  * Startup -- interface with user.
  */
 
-static char *SccsId = "@(#)main.c      2.6 %G%";
+static char *SccsId = "@(#)main.c      2.7 %G%";
 
 jmp_buf        hdrjmp;
 
 
 jmp_buf        hdrjmp;
 
@@ -253,7 +253,8 @@ main(argc, argv)
                        ef = (char *) calloc(1, strlen(ename) + 1);
                        strcpy(ef, ename);
                }
                        ef = (char *) calloc(1, strlen(ename) + 1);
                        strcpy(ef, ename);
                }
-               editfile = mailname = ef;
+               editfile = ef;
+               strcpy(mailname, ef);
        }
        if (setfile(mailname, edit) < 0)
                exit(1);
        }
        if (setfile(mailname, edit) < 0)
                exit(1);