AxWin2 - More fiddling, almost ready now :)
[tpg/acess2.git] / Usermode / Applications / ls_src / main.c
index 3ae63fd..db51613 100644 (file)
@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
        }
 
        // Traverse Directory
-       while( (tmp = readdir(fd, buf)) )
+       while( (tmp = readdir(fd, buf)) > 0 )
        {
                // Error check
                if(tmp < 0) {
@@ -260,6 +260,9 @@ void DisplayFile(char *Filename)
                if(acl.perms & 1)       perms |= 0004;  // R
                if(acl.perms & 2)       perms |= 0002;  // W
                if(acl.perms & 8)       perms |= 0001;  // X
+               
+               // Close file
+               close(fd);
        }
        free(path);     // We're finished with it
        
@@ -291,7 +294,7 @@ void DisplayFile(char *Filename)
                        else if(size < (uint64_t)2048*1024*1024*1024) { // < 2 TiB
                                printf("%4i GiB ", size>>30);
                        }
-                       else {  // Greater than 2 TiB
+                       else {  // Greater than 2 TiB (if your files are larger than this, you are Doing It Wrong [TM])
                                printf("%4i TiB ", size>>40);
                        }
                } else {

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