From fb812b93df9e0ee434930f589ad9d02c014528cb Mon Sep 17 00:00:00 2001 From: pst Date: Tue, 13 Aug 1996 00:50:59 +0000 Subject: 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 --- sbin/modload/modload.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sbin/modload') 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 @@ -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); } -- cgit v1.1