=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mail/names.c,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/mail/names.c 1997/07/14 00:24:29 1.6 --- src/usr.bin/mail/names.c 1997/07/24 17:27:12 1.7 *************** *** 1,4 **** ! /* $OpenBSD: names.c,v 1.6 1997/07/14 00:24:29 millert Exp $ */ /* $NetBSD: names.c,v 1.5 1996/06/08 19:48:32 christos Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: names.c,v 1.7 1997/07/24 17:27:12 millert Exp $ */ /* $NetBSD: names.c,v 1.5 1996/06/08 19:48:32 christos Exp $ */ /* *************** *** 38,44 **** #if 0 static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: names.c,v 1.6 1997/07/14 00:24:29 millert Exp $"; #endif #endif /* not lint */ --- 38,44 ---- #if 0 static char sccsid[] = "@(#)names.c 8.1 (Berkeley) 6/6/93"; #else ! static char rcsid[] = "$OpenBSD: names.c,v 1.7 1997/07/24 17:27:12 millert Exp $"; #endif #endif /* not lint */ *************** *** 230,236 **** char *date, *fname; FILE *fout, *fin; int ispipe; - extern char *tempEdit; top = names; np = names; --- 230,235 ---- *************** *** 253,267 **** */ if (image < 0) { ! if ((fout = Fopen(tempEdit, "a")) == NULL) { ! warn(tempEdit); senderr++; goto cant; } ! image = open(tempEdit, 2); ! (void)unlink(tempEdit); if (image < 0) { ! warn(tempEdit); senderr++; (void)Fclose(fout); goto cant; --- 252,272 ---- */ if (image < 0) { ! int fd; ! char tempname[PATHSIZE]; ! ! (void)snprintf(tempname, sizeof(tempname), ! "%s/mail.ReXXXXXXXXXX", tmpdir); ! if ((fd = mkstemp(tempname)) == -1 || ! (fout = Fdopen(fd, "a")) == NULL) { ! warn(tempname); senderr++; goto cant; } ! image = open(tempname, O_RDWR); ! (void)rm(tempname); if (image < 0) { ! warn(tempname); senderr++; (void)Fclose(fout); goto cant; *************** *** 275,281 **** (void)putc('\n', fout); (void)fflush(fout); if (ferror(fout)) ! warn(tempEdit); (void)Fclose(fout); } --- 280,286 ---- (void)putc('\n', fout); (void)fflush(fout); if (ferror(fout)) ! warn(tempname); (void)Fclose(fout); }