Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/mkubootimage Add O_TRUNC to the open of the image fi...



details:   https://anonhg.NetBSD.org/src/rev/ab76a4382d95
branches:  trunk
changeset: 767951:ab76a4382d95
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Aug 04 04:47:59 2011 +0000

description:
Add O_TRUNC to the open of the image file (in case the size decreases).

diffstat:

 usr.bin/mkubootimage/mkubootimage.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 181db54176c7 -r ab76a4382d95 usr.bin/mkubootimage/mkubootimage.c
--- a/usr.bin/mkubootimage/mkubootimage.c       Thu Aug 04 03:48:11 2011 +0000
+++ b/usr.bin/mkubootimage/mkubootimage.c       Thu Aug 04 04:47:59 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkubootimage.c,v 1.10 2011/08/03 17:46:40 matt Exp $ */
+/* $NetBSD: mkubootimage.c,v 1.11 2011/08/04 04:47:59 matt Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: mkubootimage.c,v 1.10 2011/08/03 17:46:40 matt Exp $");
+__RCSID("$NetBSD: mkubootimage.c,v 1.11 2011/08/04 04:47:59 matt Exp $");
 
 #include <sys/mman.h>
 #include <sys/stat.h>
@@ -396,7 +396,7 @@
                perror("open kernel");
                return EXIT_FAILURE;
        }
-       image_fd = open(dest, O_WRONLY|O_CREAT, 0666);
+       image_fd = open(dest, O_WRONLY|O_CREAT|O_TRUNC, 0666);
        if (image_fd == -1) {
                perror("open image");
                return EXIT_FAILURE;



Home | Main Index | Thread Index | Old Index