forked from libfuse/libfuse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix returning inode numbers from readdir() in offset==0 mode. (libfus…
…e#584) - Test added for all passthrough examples. - passthrough.c uses offset==0 mode. The others don't. - passthrough.c changed to set FUSE_FILL_DIR_PLUS to make the test pass. - This fixes libfuse#583. (cherry picked from commit 5012a05)
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Prints each directory entry and its inode as returned by 'readdir'. | ||
* Skips '.' and '..' because readdir is not required to return them and | ||
* some of our examples don't. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <sys/types.h> | ||
#include <dirent.h> | ||
#include <errno.h> | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
DIR* dirp; | ||
struct dirent* dent; | ||
|
||
if (argc != 2) { | ||
fprintf(stderr, "Usage: readdir_inode dir\n"); | ||
return 1; | ||
} | ||
|
||
dirp = opendir(argv[1]); | ||
if (dirp == NULL) { | ||
perror("failed to open directory"); | ||
return 2; | ||
} | ||
|
||
errno = 0; | ||
dent = readdir(dirp); | ||
while (dent != NULL) { | ||
if (strcmp(dent->d_name, ".") != 0 && strcmp(dent->d_name, "..") != 0) { | ||
printf("%llu %s\n", (unsigned long long)dent->d_ino, dent->d_name); | ||
} | ||
dent = readdir(dirp); | ||
} | ||
if (errno != 0) { | ||
perror("failed to read directory entry"); | ||
return 3; | ||
} | ||
|
||
closedir(dirp); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters