--- boot.c.orig	2013-01-22 14:05:26.000000000 -0800
+++ boot.c.patched	2013-01-23 10:48:44.000000000 -0800
@@ -37,11 +37,21 @@
     fd = open(*ext_path, O_CREAT | O_EXCL | O_WRONLY | OPEN_O_BINARY, 0755);
     if ( fd == -1 ) {
         struct stat statbuf;
-        if ( errno == EEXIST 
-             && par_lstat(*ext_path, &statbuf) == 0 
-             && statbuf.st_size == emb_file->size )
-            return 1;           /* file already exists and has the expected size */
-        return 0;
+        if ( errno == EEXIST ) {
+	    if ( par_lstat(*ext_path, &statbuf) == 0 
+                 && statbuf.st_size == emb_file->size ) {
+		return 1;           /* file already exists and has the expected size */
+	    } else {
+		/* Try to reopen for rewrite */
+		fprintf(stderr, "extract_embedded_file(%s): rewriting due to size mismatch\n", *ext_path);
+		fd = open(*ext_path, O_CREAT | O_WRONLY | OPEN_O_BINARY, 0755);
+		if ( fd == -1 ) {
+		    return 0;
+		}
+	    }
+	} else {
+	    return 0;
+	}
     }
 
     chunk = emb_file->chunks;
