From: David Levine Date: Sat, 25 Jan 2014 02:29:38 +0000 (-0600) Subject: Replaced use of mkstemp() with m_mktemp() in lock_file.c. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/351a74de3e5d3cd2048d2ec4444b090c6b7e00ac?ds=sidebyside;hp=-c Replaced use of mkstemp() with m_mktemp() in lock_file.c. --- 351a74de3e5d3cd2048d2ec4444b090c6b7e00ac 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); }