Skip to content

Commit d1d1b86

Browse files
Fix d_type issue
1 parent 04e0ec8 commit d1d1b86

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: src/strucclustutils/structcreatedb.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <iostream>
2020
#include <dirent.h>
21+
#include <sys/stat.h>
2122

2223
#ifdef HAVE_GCS
2324
#include "google/cloud/storage/client.h"
@@ -261,11 +262,15 @@ int createdb(int argc, const char **argv, const Command& command) {
261262
}
262263
while (dirent* entry = readdir(handle)) {
263264
std::string filename(entry->d_name);
265+
264266
if (filename != "." && filename !="..") {
265-
if (entry->d_type == DT_DIR) {
266-
dirs.push_back(dir+"/"+filename);
267+
std::string fullpath = dir + "/" + filename;
268+
struct stat info;
269+
stat(fullpath.c_str(), &info);
270+
if (info.st_mode & S_IFDIR) {
271+
dirs.push_back(fullpath);
267272
} else {
268-
par.filenames.push_back(dir+"/"+filename);
273+
par.filenames.push_back(fullpath);
269274
}
270275
}
271276
}

0 commit comments

Comments
 (0)