From 351a74de3e5d3cd2048d2ec4444b090c6b7e00ac Mon Sep 17 00:00:00 2001 From: David Levine Date: Fri, 24 Jan 2014 20:29:38 -0600 Subject: [PATCH] Replaced use of mkstemp() with m_mktemp() in lock_file.c. --- sbr/lock_file.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sbr/lock_file.c b/sbr/lock_file.c index 01d7ae49..6a3be519 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -543,17 +543,18 @@ static int lockit (struct lockinfo *li) { int fd; - char *curlock, *tmplock; + char *curlock, *tmpfile; #if 0 char buffer[128]; #endif curlock = li->curlock; - tmplock = li->tmplock; - if ((fd = mkstemp(tmplock)) == -1) + if ((tmpfile = m_mktemp(li->tmplock, &fd, NULL)) == NULL) { + advise(NULL, "unable to create temporary file in %s", get_temp_dir()); return -1; + } #if 0 /* write our process id into lock file */ @@ -567,8 +568,8 @@ lockit (struct lockinfo *li) * Now try to create the real lock file * by linking to the temporary file. */ - fd = link(tmplock, curlock); - unlink(tmplock); + fd = link(tmpfile, curlock); + unlink(tmpfile); return (fd == -1 ? -1 : 0); } -- 2.56.0