list<string> snaps;
char path[PATH_MAX];
- char buf[offsetof(struct dirent, d_name) + PATH_MAX + 1];
struct dirent *de;
- while (::readdir_r(dir, (struct dirent *)&buf, &de) == 0) {
- if (!de)
- break;
-
+ while ((de = ::readdir(dir))) {
snprintf(path, sizeof(path), "%s/%s", get_basedir_path().c_str(), de->d_name);
struct stat st;
return r;
}
- char buf[offsetof(struct dirent, d_name) + PATH_MAX + 1];
- struct dirent *de;
- while ((r = ::readdir_r(dir, (struct dirent *)&buf, &de)) == 0) {
- if (!de)
- break;
+ struct dirent *de = nullptr;
+ while ((de = ::readdir(dir))) {
if (de->d_type == DT_UNKNOWN) {
// d_type not supported (non-ext[234], btrfs), must stat
struct stat sb;
}
if (r > 0) {
- derr << "trying readdir_r " << fn << ": " << cpp_strerror(r) << dendl;
+ derr << "trying readdir " << fn << ": " << cpp_strerror(r) << dendl;
r = -r;
}
{
string to_list_path = get_full_path_subdir(to_list);
DIR *dir = ::opendir(to_list_path.c_str());
- char buf[offsetof(struct dirent, d_name) + PATH_MAX + 1];
- int r;
if (!dir) {
return -errno;
}
seekdir(dir, *handle);
}
- struct dirent *de;
+ struct dirent *de = nullptr;
+ int r = 0;
int listed = 0;
- bool end = false;
- while (!::readdir_r(dir, reinterpret_cast<struct dirent*>(buf), &de)) {
- if (!de) {
- end = true;
- break;
- }
+ bool end = true;
+ while ((de = ::readdir(dir))) {
+ end = false;
if (max_objs > 0 && listed >= max_objs) {
break;
}
{
string to_list_path = get_full_path_subdir(to_list);
DIR *dir = ::opendir(to_list_path.c_str());
- char buf[offsetof(struct dirent, d_name) + PATH_MAX + 1];
if (!dir)
return -errno;
- struct dirent *de;
- while (!::readdir_r(dir, reinterpret_cast<struct dirent*>(buf), &de)) {
- if (!de) {
- break;
- }
+ struct dirent *de = nullptr;
+ while ((de = ::readdir(dir))) {
string short_name(de->d_name);
string demangled_name;
if (lfn_is_subdir(short_name, &demangled_name)) {