X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/2f689a1cb907a5de04e6d39ffd217a69af3216c7..bd2b8bee74ecbc7d94b950790762913d3fcd9a64:/sbr/m_mktemp.c diff --git a/sbr/m_mktemp.c b/sbr/m_mktemp.c index 22290363..ca4ab29c 100644 --- a/sbr/m_mktemp.c +++ b/sbr/m_mktemp.c @@ -1,14 +1,11 @@ /* * m_mktemp.c -- Construct a temporary file. * - * $Id$ - * * This code is Copyright (c) 2010, by the authors of nmh. See the * COPYRIGHT file in the root directory of the nmh distribution for * complete copyright information. */ -#include #include static char *get_temp_dir(); @@ -109,6 +106,7 @@ m_mktemp2 ( { static char buffer[BUFSIZ]; char *cp; + int n; if (dir_in == NULL) { if (pfx_in == NULL) { @@ -122,7 +120,7 @@ m_mktemp2 ( /* No directory component */ return m_mktemp(pfx_in, fd_ret, fp_ret); } - int n = (int)(cp-dir_in-1); /* Length of dir component */ + n = (int)(cp-dir_in); /* Length of dir component */ snprintf(buffer, sizeof(buffer), "%.*s%s", n, dir_in, pfx_in); return m_mktemp(buffer, fd_ret, fp_ret); } @@ -131,7 +129,7 @@ m_mktemp2 ( static char * get_temp_dir() { - // Ignore envvars if we are setuid + /* Ignore envvars if we are setuid */ if ((getuid()==geteuid()) && (getgid()==getegid())) { char *tmpdir = NULL; tmpdir = getenv("MHTMPDIR");