Use mkstemp(3) instead of tmpnam(3) when creating temporary files for mode
page editing. Submitted by: roberto Reviewed by: imp, ken
This commit is contained in:
parent
738e2698d7
commit
54e1a5844c
@ -291,10 +291,13 @@ edit_done(void)
|
||||
static void
|
||||
edit_init(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
edit_rewind();
|
||||
if (tmpnam(edit_name) == 0)
|
||||
errx(1, "tmpnam failed");
|
||||
if ((edit_file = fopen(edit_name, "w")) == 0)
|
||||
strlcpy(edit_name, "/tmp/camXXXXXX", sizeof(edit_name));
|
||||
if ((fd = mkstemp(edit_name)) == -1)
|
||||
errx(1, "mkstemp failed");
|
||||
if ((edit_file = fdopen(fd, "w")) == 0)
|
||||
err(1, "%s", edit_name);
|
||||
edit_opened = 1;
|
||||
|
||||
|
@ -291,10 +291,13 @@ edit_done(void)
|
||||
static void
|
||||
edit_init(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
edit_rewind();
|
||||
if (tmpnam(edit_name) == 0)
|
||||
errx(1, "tmpnam failed");
|
||||
if ((edit_file = fopen(edit_name, "w")) == 0)
|
||||
strlcpy(edit_name, "/tmp/camXXXXXX", sizeof(edit_name));
|
||||
if ((fd = mkstemp(edit_name)) == -1)
|
||||
errx(1, "mkstemp failed");
|
||||
if ((edit_file = fdopen(fd, "w")) == 0)
|
||||
err(1, "%s", edit_name);
|
||||
edit_opened = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user