X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fls_src%2Fmain.c;h=db5161306a98f5d1edfc5c11654b22af799a4deb;hb=b96d38a6740c05ef7544113459407f7e31492af1;hp=3ae63fd936883e238c18ef905831f46311814825;hpb=a2210987109ab5a6337c72b45f7e52cfc9092f8f;p=tpg%2Facess2.git diff --git a/Usermode/Applications/ls_src/main.c b/Usermode/Applications/ls_src/main.c index 3ae63fd9..db516130 100644 --- a/Usermode/Applications/ls_src/main.c +++ b/Usermode/Applications/ls_src/main.c @@ -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 {