public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "galaxyking0419 at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/29228] New: ftw() does not find all directories Date: Mon, 06 Jun 2022 08:50:20 +0000 [thread overview] Message-ID: <bug-29228-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29228 Bug ID: 29228 Summary: ftw() does not find all directories Product: glibc Version: 2.35 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: galaxyking0419 at gmail dot com CC: drepper.fsp at gmail dot com Target Milestone: --- The ftw() function will miss some directories on my system (.e.g /usr/local/man) unless use the directory as the starting directory. Consider the following snippet: #include <errno.h> #include <stdio.h> #include <string.h> #include <ftw.h> static inline int callback(const char *path, const struct stat *stat, int flag) { if (strcmp(path, "/usr/local/man") == 0) printf("Found %s\n", path); return 0; } int main(int argc, const char *argv[]) { if (ftw(argv[1], callback, 4096) != 0) { printf("ERROR: Failed to traverse the directory tree! (%s)\n", strerror(errno)); return 3; } return 0; } Command Output: [root@NoteBook xxx]# ./a.out /usr [root@NoteBook xxx]# ./a.out /usr/local [root@NoteBook xxx]# ./a.out /usr/local/man Found /usr/local/man -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-06-06 8:50 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-06-06 8:50 galaxyking0419 at gmail dot com [this message] 2022-06-06 17:58 ` [Bug libc/29228] " fweimer at redhat dot com 2022-06-07 2:26 ` galaxyking0419 at gmail dot com 2022-06-07 6:10 ` fweimer at redhat dot com 2022-06-07 6:11 ` fweimer at redhat dot com 2022-06-07 6:56 ` galaxyking0419 at gmail dot com 2022-06-07 7:28 ` fweimer at redhat dot com 2022-06-07 9:49 ` galaxyking0419 at gmail dot com 2022-06-07 9:55 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29228-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).