SCCS-vsn: libexec/mail.local/mail.local.c 4.24
-static char sccsid[] = "@(#)mail.local.c 4.23 (Berkeley) %G%";
+static char sccsid[] = "@(#)mail.local.c 4.24 (Berkeley) %G%";
#endif
#include <sys/types.h>
#endif
#include <sys/types.h>
- mktemp(lettmp);
- unlink(lettmp);
my_name = getlogin();
if (my_name == NULL || *my_name == '\0') {
struct passwd *pwent;
my_name = getlogin();
if (my_name == NULL || *my_name == '\0') {
struct passwd *pwent;
done();
for (i=SIGHUP; i<=SIGTERM; i++)
setsig(i, delex);
done();
for (i=SIGHUP; i<=SIGTERM; i++)
setsig(i, delex);
- tmpf = fopen(lettmp, "w+r");
- if (tmpf == NULL)
+ i = mkstemp(lettmp);
+ tmpf = fdopen(i, "r+w");
+ if (i < 0 || tmpf == NULL)
panic("mail: %s: cannot open for writing", lettmp);
/*
* This protects against others reading mail from temp file and
panic("mail: %s: cannot open for writing", lettmp);
/*
* This protects against others reading mail from temp file and