summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1999-09-28 02:01:46 +0000
committerken <ken@FreeBSD.org>1999-09-28 02:01:46 +0000
commit89ae90a8d21247f30af535bfa0d5922de5885b96 (patch)
tree3bb8b4cebce20be6cb3185fc6e3ee40777facde3 /sbin
parentef811049fdfd0f5360679351f1e7845c915caee9 (diff)
downloadFreeBSD-src-89ae90a8d21247f30af535bfa0d5922de5885b96.zip
FreeBSD-src-89ae90a8d21247f30af535bfa0d5922de5885b96.tar.gz
Use mkstemp(3) instead of tmpnam(3) when creating temporary files for mode
page editing. Submitted by: roberto Reviewed by: imp, ken
Diffstat (limited to 'sbin')
-rw-r--r--sbin/camcontrol/modeedit.c9
-rw-r--r--sbin/camcontrol/util.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c
index 811c42f..74fbb08 100644
--- a/sbin/camcontrol/modeedit.c
+++ b/sbin/camcontrol/modeedit.c
@@ -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;
diff --git a/sbin/camcontrol/util.c b/sbin/camcontrol/util.c
index 811c42f..74fbb08 100644
--- a/sbin/camcontrol/util.c
+++ b/sbin/camcontrol/util.c
@@ -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;
OpenPOWER on IntegriCloud