diff options
Diffstat (limited to 'sbin/camcontrol/modeedit.c')
-rw-r--r-- | sbin/camcontrol/modeedit.c | 9 |
1 files changed, 6 insertions, 3 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; |