• Jakob Unterwurzacher's avatar
    fs: fix Inode.IsDir logic · 458f01e0
    Jakob Unterwurzacher authored
    The file type is not a bitmap, and looking at
    
    	S_IFBLK                          = 0x6000
    	S_IFCHR                          = 0x2000
    	S_IFDIR                          = 0x4000
    	S_IFIFO                          = 0x1000
    	S_IFLNK                          = 0xa000
    	S_IFREG                          = 0x8000
    	S_IFSOCK                         = 0xc000
    
    and confirmed by the added test, we used to classify
    block devices and sockets as directories:
    
     --- FAIL: TestInodeIsDir (0.00s)
         inode_test.go:25: wrong result for case struct { mode uint32; dir bool }{mode:0x6000, dir:false}
         inode_test.go:25: wrong result for case struct { mode uint32; dir bool }{mode:0xc000, dir:false}
    
    The check is fixed now and the test passes.
    
    Change-Id: I6490992d1fecc8a6bea7c2c4b2f1bca765d03d4c
    458f01e0
inode.go 20.2 KB