-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utils: address the deprecated readdir_r function usage #184
base: master
Are you sure you want to change the base?
Conversation
utils/fs/directory.cpp: In member function ‘void utils::fs::detail::directory_iterator::impl::next()’: utils/fs/directory.cpp:201:15: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations] if (::readdir_r(_dirp, &_dirent, &result) == -1) { ^~~~~~~~~ In file included from utils/fs/directory.cpp:34: /usr/include/dirent.h:183:12: note: declared here extern int readdir_r (DIR *__restrict __dirp, ^~~~~~~~~ utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations] if (::readdir_r(_dirp, &_dirent, &result) == -1) { ^ In file included from utils/fs/directory.cpp:34: /usr/include/dirent.h:183:12: note: declared here extern int readdir_r (DIR *__restrict __dirp, ^~~~~~~~~ utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations] if (::readdir_r(_dirp, &_dirent, &result) == -1) { ^ In file included from utils/fs/directory.cpp:34: /usr/include/dirent.h:183:12: note: declared here extern int readdir_r (DIR *__restrict __dirp, ^~~~~~~~~ cc1plus: all warnings being treated as errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the consequences of this change regarding threads? Kyua is currently not threaded, but this would make the directory class not thread-safe, right?
Also, I'll need you to deal with https://cla.developers.google.com/ before I can accept this PR.
Thanks
throw fs::system_error(F("readdir_r(%s) failed") % _path, | ||
original_errno); | ||
} | ||
result = ::readdir(_dirp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge initialization with definition, which in turn lets you declare the variable as const.
/// Custom representation of the directory entry. | ||
/// | ||
/// This is separate from _dirent because this is the type we return to the | ||
/// This is separate from readdir because this is the type we return to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_dirent
used to refer to a specific field. "separate from readdir" now doesn't make a lot of sense. Please reword.
@googlebot rescan (Mass-triggering a rescan of all open PRs as I have just configured automated CLA checks but the bot won't go through the backlog on its own.) |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@ckhardin: is it ok if I pick this review up? I noticed this problem when I was trying to compile kyua on Fedora 29 with g++, so I'd like to make forward progress with the issue that you started working on. |
@ngie-eign - that's fine, we patched locally with this change to get it going. |
When you say, "locally", do you mean Fedora Linux? |
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@ngie-eign - no, buildroot - we do an embedded build, so we add patches into buildroot per package to things to compile. |
Ah, gotcha. |
@googlebot rescan |
I guess I can't do that :D. |
utils/fs/directory.cpp: In member function ‘void utils::fs::detail::directory_iterator::impl::next()’:
utils/fs/directory.cpp:201:15: error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^~~~~~~~~
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR __restrict __dirp,
^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR __restrict __dirp,
^~~~~~~~~
utils/fs/directory.cpp:201:49: error: ‘int readdir_r(DIR, dirent*, dirent**)’ is deprecated [-Werror=deprecated-declarations]
if (::readdir_r(_dirp, &_dirent, &result) == -1) {
^
In file included from utils/fs/directory.cpp:34:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
cc1plus: all warnings being treated as errors