summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>1998-07-27 22:26:25 +0000
committernectar <nectar@FreeBSD.org>1998-07-27 22:26:25 +0000
commiteb97908cb74e4ad6501f55030258ea26fd61f3e3 (patch)
tree70a9b700293f48b0823e60e997279846af268b16 /usr.sbin
parent80ac8b0511b3704c9768a5a5ea07005ce296c9ef (diff)
downloadFreeBSD-src-eb97908cb74e4ad6501f55030258ea26fd61f3e3.zip
FreeBSD-src-eb97908cb74e4ad6501f55030258ea26fd61f3e3.tar.gz
Paranoia: use mkstemp instead of mktemp.
PR: bin/3211 Reported by: Mark Pritchard <mpp@FreeBSD.ORG>
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ctm/ctm_rmail/ctm_rmail.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.sbin/ctm/ctm_rmail/ctm_rmail.c b/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
index 6b01922..a456cbe 100644
--- a/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
+++ b/usr.sbin/ctm/ctm_rmail/ctm_rmail.c
@@ -254,6 +254,7 @@ read_piece(char *input_file)
{
int status = 0;
FILE *ifp, *ofp = 0;
+ int ofd;
int decoding = 0;
int got_one = 0;
int line_no = 0;
@@ -303,13 +304,13 @@ read_piece(char *input_file)
got_one++;
strcpy(tname, piece_dir);
strcat(tname, "/p.XXXXXX");
- if (mktemp(tname) == NULL)
+ if ((ofd = mkstemp(tname)) < 0)
{
- err("*mktemp: '%s'", tname);
+ err("*mkstemp: '%s'", tname);
status++;
continue;
}
- if ((ofp = fopen(tname, "w")) == NULL)
+ if ((ofp = fdopen(ofd, "w")) == NULL)
{
err("cannot open '%s' for writing", tname);
status++;
@@ -492,17 +493,18 @@ int
combine(char *delta, int npieces, char *dname, char *pname, char *tname)
{
FILE *dfp, *pfp;
+ int dfd;
int i, n, e;
char buf[BUFSIZ];
strcpy(tname, delta_dir);
strcat(tname, "/d.XXXXXX");
- if (mktemp(tname) == NULL)
+ if ((dfd = mkstemp(tname)) < 0)
{
- err("*mktemp: '%s'", tname);
+ err("*mkstemp: '%s'", tname);
return 0;
}
- if ((dfp = fopen(tname, "w")) == NULL)
+ if ((dfp = fdopen(dfd, "w")) == NULL)
{
err("cannot open '%s' for writing", tname);
return 0;
OpenPOWER on IntegriCloud