< prev index next >

src/java.base/unix/native/libjava/TimeZone_md.c

Print this page




 130     int res;
 131     long name_max = 0;
 132 
 133     dirp = opendir(dir);
 134     if (dirp == NULL) {
 135         return NULL;
 136     }
 137 
 138     name_max = pathconf(dir, _PC_NAME_MAX);
 139     // If pathconf did not work, fall back to a mimimum buffer size.
 140     if (name_max < 1024) {
 141         name_max = 1024;
 142     }
 143 
 144     entry = (struct dirent64 *)malloc(offsetof(struct dirent64, d_name) + name_max + 1);
 145     if (entry == NULL) {
 146         (void) closedir(dirp);
 147         return NULL;
 148     }
 149 


 150     while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {

 151         /*
 152          * Skip '.' and '..' (and possibly other .* files)
 153          */
 154         if (dp->d_name[0] == '.') {
 155             continue;
 156         }
 157 
 158         /*
 159          * Skip "ROC", "posixrules", and "localtime".
 160          */
 161         if ((strcmp(dp->d_name, "ROC") == 0)
 162             || (strcmp(dp->d_name, "posixrules") == 0)
 163 #if defined(__solaris__)
 164             /*
 165              * Skip the "src" and "tab" directories on Solaris.
 166              */
 167             || (strcmp(dp->d_name, "src") == 0)
 168             || (strcmp(dp->d_name, "tab") == 0)
 169 #endif
 170             || (strcmp(dp->d_name, "localtime") == 0)) {




 130     int res;
 131     long name_max = 0;
 132 
 133     dirp = opendir(dir);
 134     if (dirp == NULL) {
 135         return NULL;
 136     }
 137 
 138     name_max = pathconf(dir, _PC_NAME_MAX);
 139     // If pathconf did not work, fall back to a mimimum buffer size.
 140     if (name_max < 1024) {
 141         name_max = 1024;
 142     }
 143 
 144     entry = (struct dirent64 *)malloc(offsetof(struct dirent64, d_name) + name_max + 1);
 145     if (entry == NULL) {
 146         (void) closedir(dirp);
 147         return NULL;
 148     }
 149 
 150 #pragma GCC diagnostic push
 151 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 152     while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
 153 #pragma GCC diagnostic pop
 154         /*
 155          * Skip '.' and '..' (and possibly other .* files)
 156          */
 157         if (dp->d_name[0] == '.') {
 158             continue;
 159         }
 160 
 161         /*
 162          * Skip "ROC", "posixrules", and "localtime".
 163          */
 164         if ((strcmp(dp->d_name, "ROC") == 0)
 165             || (strcmp(dp->d_name, "posixrules") == 0)
 166 #if defined(__solaris__)
 167             /*
 168              * Skip the "src" and "tab" directories on Solaris.
 169              */
 170             || (strcmp(dp->d_name, "src") == 0)
 171             || (strcmp(dp->d_name, "tab") == 0)
 172 #endif
 173             || (strcmp(dp->d_name, "localtime") == 0)) {


< prev index next >