Trying to reduce the ability for a fork bomb to fault the kernel
[tpg/acess2.git] / Usermode / Applications / ls_src / main.c
index 57ff306..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) {
@@ -294,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