[Groonga-mysql-commit] mroonga/mroonga [master] solaris: use stat() instead of dirent.d_type

Back to archive index

null+****@clear***** null+****@clear*****
2012年 3月 19日 (月) 09:51:20 JST


Kouhei Sutou	2012-03-19 09:51:20 +0900 (Mon, 19 Mar 2012)

  New Revision: db8d4b9ed36c8aa72473efaf2bc4c9061720e6a4

  Log:
    solaris: use stat() instead of dirent.d_type
    
    Reported by Kazuhiko Shiozaki. Thanks!!!

  Modified files:
    ha_mroonga.cc

  Modified: ha_mroonga.cc (+5 -1)
===================================================================
--- ha_mroonga.cc    2012-03-18 19:03:06 +0900 (27b6160)
+++ ha_mroonga.cc    2012-03-19 09:51:20 +0900 (918774e)
@@ -7152,7 +7152,11 @@ void ha_mroonga::remove_grn_obj_force(const char *name)
         DIR *dir = opendir(".");
         if (dir) {
           while (struct dirent *entry = readdir(dir)) {
-            if (entry->d_type != DT_REG) {
+            struct stat file_status;
+            if (stat(entry->d_name, &file_status) != 0) {
+              continue;
+            }
+            if (!((file_status.st_mode & S_IFMT) && S_IFREG)) {
               continue;
             }
             if (strncmp(entry->d_name, path, path_length) == 0) {




Groonga-mysql-commit メーリングリストの案内
Back to archive index