diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-03-22 23:17:51 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2001-03-22 23:17:51 +0000 |
commit | 2b0418f5df50f24ee353811129349314912871f0 (patch) | |
tree | 88758377d3420c368177031626e10d6c2bb58e37 /sbin/modload | |
parent | 65b8c5fce5df95a015e72afac37cdfb79ce6d2fe (diff) |
use mkstemp()
Diffstat (limited to 'sbin/modload')
-rw-r--r-- | sbin/modload/modload.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index 01b7e4e9ec2..fa0c69b601d 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modload.c,v 1.23 2001/03/15 18:00:37 deraadt Exp $ */ +/* $OpenBSD: modload.c,v 1.24 2001/03/22 23:17:50 deraadt Exp $ */ /* $NetBSD: modload.c,v 1.13 1995/05/28 05:21:58 jtc Exp $ */ /* @@ -253,7 +253,11 @@ main(argc, argv) p++; /* skip over '/' */ else p = modobj; - snprintf(modout, sizeof modout, "%s%sut", _PATH_TMP, p); + snprintf(modout, sizeof modout, "%s%s.XXXXXXXX.o", + _PATH_TMP, p); + if (modfd = mkstemps(modout, strlen(".o")) == -1) + err(1, "creating %s", modout); + close(modfd); out = modout; /* * reverse meaning of -u - if we've generated a /tmp @@ -274,9 +278,6 @@ main(argc, argv) entry[strlen(entry) - 2] = '\0'; /* chop off .o */ } - if ((modfd = open(out, O_RDWR | O_EXCL | O_CREAT, 0600)) < 0) - err(1, "creating %s", out); - close(modfd); /* * Prelink to get file size |