git: 9front

Download patch

ref: 19814f66a3529608a0c8a75d01ce89a614e41548
parent: 047971fe837c144dff977e60c0ff831101aa2283
author: aiju <devnull@localhost>
date: Wed Oct 3 13:23:17 EDT 2012

fixed potential bug in hjfs

--- a/sys/src/cmd/hjfs/fs1.c
+++ b/sys/src/cmd/hjfs/fs1.c
@@ -482,7 +482,7 @@
 /*
  * getblk returns the address of a block in a file
  * given its relative address blk
- * the address and generation are returned in *r and *gen
+ * the address are returned in *r
  * mode has to be one of:
  * - GBREAD: this block will only be read
  * - GBWRITE: this block will be written, but don't create it
@@ -493,7 +493,6 @@
  * return value is 1 if the block existed, -1 on error
  * a return value of 0 means the block did not exist
  * this is only an error in case of GBREAD and GBWRITE
- * gen == nil allowed
  */
 
 int
@@ -897,8 +896,10 @@
 			continue;
 		if(rc == 0){
 			memset(c->de, 0, sizeof(c->de));
-			if(i == d->size)
+			if(i == d->size){
 				d->size++;
+				b->op |= BDELWRI;
+			}
 		}
 		for(j = 0; j < DEPERBLK; j++){
 			if(si == -1 && (c->de[j].mode & DALLOC) == 0){
--