diff options
author | pst <pst@FreeBSD.org> | 1996-08-13 00:50:59 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1996-08-13 00:50:59 +0000 |
commit | fb812b93df9e0ee434930f589ad9d02c014528cb (patch) | |
tree | c0cf753e4c3dc8b91194fbab4fc55ac6ba37cc22 | |
parent | 74116e670f56be16c94f1d8e8453b33de892293c (diff) | |
download | FreeBSD-src-fb812b93df9e0ee434930f589ad9d02c014528cb.zip FreeBSD-src-fb812b93df9e0ee434930f589ad9d02c014528cb.tar.gz |
Attempt to unlink any stale .o files before relocating code.
Abort if a file is still present, and make output file mode 0600.
Reviewed by: bde
-rw-r--r-- | sbin/modload/modload.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c index a9cf18f..ee6ca0a 100644 --- a/sbin/modload/modload.c +++ b/sbin/modload/modload.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: modload.c,v 1.11 1996/04/26 18:39:48 erich Exp $ + * $Id: modload.c,v 1.12 1996/08/13 00:43:01 pst Exp $ */ #include <stdio.h> @@ -256,7 +256,8 @@ main(argc, argv) entry[strlen(entry) - 2] = '\0'; /* chop off .o */ } - modfd = open(out, O_RDWR | O_CREAT, 0666); + (void) unlink(out); + modfd = open(out, O_RDWR | O_CREAT | O_EXCL, 0600); if(modfd < 0) { err(1, "creating %s", out); } |