Debug
authorJohn Hodge <[email protected]>
Sun, 27 Sep 2009 08:46:05 +0000 (16:46 +0800)
committerJohn Hodge <[email protected]>
Sun, 27 Sep 2009 08:46:05 +0000 (16:46 +0800)
Kernel/vfs/fs/fat.c
Usermode/Applications/cat_src/main.c

index e03df09..533e9cc 100644 (file)
@@ -343,11 +343,14 @@ Uint64 FAT_Read(tVFS_Node *node, Uint64 offset, Uint64 length, void *buffer)
        }\r
        \r
        // Sanity Check offset\r
-       if(offset > node->Size){\r
+       if(offset > node->Size) {\r
+               Log("FAT_Read: Reading past EOF (%i > %i)", offset, node->Size);\r
                return 0;\r
        }\r
        // Clamp Size\r
-       if(length + offset > node->Size) {\r
+       if(offset + length > node->Size) {\r
+               Log("FAT_Read: Reading past EOF (%i+%i+ > %i), clamped to %i",\r
+                       offset, length, node->Size, offset - node->Size);\r
                length = offset - node->Size;\r
        }\r
        \r
index c60ab27..9877628 100644 (file)
@@ -18,6 +18,7 @@ int main(int argc, char *argv[])
                return -1;
        }
 
+       printf("Contents of `%s'\n", argv[1]);
        fd = open(argv[1], OPENFLAG_READ);
        if(fd == -1) {
                printf("Unable to open '%s' for reading\n", argv[1]);

UCC git Repository :: git.ucc.asn.au