mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-04 12:52:15 +00:00
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
222e52ceae
commit
3def3fe132
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51737
@ -291,10 +291,13 @@ edit_done(void)
|
|||||||
static void
|
static void
|
||||||
edit_init(void)
|
edit_init(void)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
edit_rewind();
|
edit_rewind();
|
||||||
if (tmpnam(edit_name) == 0)
|
strlcpy(edit_name, "/tmp/camXXXXXX", sizeof(edit_name));
|
||||||
errx(1, "tmpnam failed");
|
if ((fd = mkstemp(edit_name)) == -1)
|
||||||
if ((edit_file = fopen(edit_name, "w")) == 0)
|
errx(1, "mkstemp failed");
|
||||||
|
if ((edit_file = fdopen(fd, "w")) == 0)
|
||||||
err(1, "%s", edit_name);
|
err(1, "%s", edit_name);
|
||||||
edit_opened = 1;
|
edit_opened = 1;
|
||||||
|
|
||||||
|
@ -291,10 +291,13 @@ edit_done(void)
|
|||||||
static void
|
static void
|
||||||
edit_init(void)
|
edit_init(void)
|
||||||
{
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
edit_rewind();
|
edit_rewind();
|
||||||
if (tmpnam(edit_name) == 0)
|
strlcpy(edit_name, "/tmp/camXXXXXX", sizeof(edit_name));
|
||||||
errx(1, "tmpnam failed");
|
if ((fd = mkstemp(edit_name)) == -1)
|
||||||
if ((edit_file = fopen(edit_name, "w")) == 0)
|
errx(1, "mkstemp failed");
|
||||||
|
if ((edit_file = fdopen(fd, "w")) == 0)
|
||||||
err(1, "%s", edit_name);
|
err(1, "%s", edit_name);
|
||||||
edit_opened = 1;
|
edit_opened = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user