Module Name:    src
Committed By:   matt
Date:           Thu Aug  4 04:47:59 UTC 2011

Modified Files:
        src/usr.bin/mkubootimage: mkubootimage.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/mkubootimage/mkubootimage.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/mkubootimage/mkubootimage.c
diff -u src/usr.bin/mkubootimage/mkubootimage.c:1.10 src/usr.bin/mkubootimage/mkubootimage.c:1.11
--- src/usr.bin/mkubootimage/mkubootimage.c:1.10	Wed Aug  3 17:46:40 2011
+++ src/usr.bin/mkubootimage/mkubootimage.c	Thu Aug  4 04:47:59 2011
@@ -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 <[email protected]>
@@ -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;

Reply via email to