mirror of
https://github.com/drasko/codezero.git
synced 2026-02-24 15:53:14 +01:00
Open wasn't returning the fd but 0 on success :-S. fixed.
This commit is contained in:
@@ -113,7 +113,8 @@ int lsdir(char *path)
|
||||
if ((fd = open(path, O_RDONLY)) < 0) {
|
||||
perror("OPEN");
|
||||
return 0;
|
||||
}
|
||||
} else
|
||||
printf("Got fd: %d for opening %s\n", fd, path);
|
||||
|
||||
if ((bytes = os_readdir(fd, dents, sizeof(struct dirent) * DENTS_TOTAL)) < 0) {
|
||||
perror("GETDENTS\n");
|
||||
@@ -161,6 +162,9 @@ int dirtest(void)
|
||||
printf("\nlsdir root directory:\n");
|
||||
lsdir("/");
|
||||
|
||||
printf("\nlsdir /usr:\n");
|
||||
lsdir("/usr");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user