[openfirmware] [commit] r2946 - ofw/fs/ext2fs

repository service svn at openfirmware.info
Thu Apr 19 21:05:55 CEST 2012


Author: wmb
Date: Thu Apr 19 21:05:54 2012
New Revision: 2946
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2946

Log:
OLPC trac 11786 - fixed bug with file deletion introduced by svn 2817.

Modified:
   ofw/fs/ext2fs/dir.fth

Modified: ofw/fs/ext2fs/dir.fth
==============================================================================
--- ofw/fs/ext2fs/dir.fth	Thu Apr 19 03:43:07 2012	(r2945)
+++ ofw/fs/ext2fs/dir.fth	Thu Apr 19 21:05:54 2012	(r2946)
@@ -77,15 +77,25 @@
 
 : +link-count  ( increment -- )
    \ link-count = 1 means that the directory has more links than can
-   \ be represented in a 16-bit number
-   link-count 1 =  if  drop exit  then  \ Don't increment if already 1
+   \ be represented in a 16-bit number; don't increment in that case.
+   dir?  if                ( increment )
+      link-count 1 =  if   ( increment )
+         drop exit         ( -- )
+      then                 ( increment )
+   then                    ( increment )
+
+   link-count +            ( link-count' )
 
    \ If the incremented value exceeds the limit, store 1
    \ We should also set the RO_COMPAT_DIR_NLINK bit in the superblock,
-   \ but we assume that OFW won't really be used to create enormous directories
-   link-count +  dup d# 65000 >=  if  drop 1  then  ( link-count )
+   \ but we assume that OFW won't be used to create enormous directories
+   dir?  if                ( link-count )
+      dup d# 65000 >=  if  ( link-count )
+         drop 1            ( link-count' )
+      then                 ( link-count' )
+   then                    ( link-count )
 
-   link-count!
+   link-count!             ( )
 ;
 
 : new-inode    ( mode -- inode# )



More information about the openfirmware mailing list