equal
deleted
inserted
replaced
128 struct dirent *dp = NULL; |
128 struct dirent *dp = NULL; |
129 char *pathname = NULL; |
129 char *pathname = NULL; |
130 char *tz = NULL; |
130 char *tz = NULL; |
131 int res; |
131 int res; |
132 |
132 |
133 dirp = opendir(dir); |
|
134 if (dirp == NULL) { |
|
135 return NULL; |
|
136 } |
|
137 |
|
138 if (strcmp(dir, ZONEINFO_DIR) == 0) { |
133 if (strcmp(dir, ZONEINFO_DIR) == 0) { |
139 /* fast path for 1st iteration */ |
134 /* fast path for 1st iteration */ |
140 for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) { |
135 for (unsigned int i = 0; i < sizeof (popularZones) / sizeof (popularZones[0]); i++) { |
141 pathname = getPathName(dir, popularZones[i]); |
136 pathname = getPathName(dir, popularZones[i]); |
142 if (pathname == NULL) { |
137 if (pathname == NULL) { |
147 pathname = NULL; |
142 pathname = NULL; |
148 if (tz != NULL) { |
143 if (tz != NULL) { |
149 return tz; |
144 return tz; |
150 } |
145 } |
151 } |
146 } |
|
147 } |
|
148 |
|
149 dirp = opendir(dir); |
|
150 if (dirp == NULL) { |
|
151 return NULL; |
152 } |
152 } |
153 |
153 |
154 while ((dp = readdir(dirp)) != NULL) { |
154 while ((dp = readdir(dirp)) != NULL) { |
155 /* |
155 /* |
156 * Skip '.' and '..' (and possibly other .* files) |
156 * Skip '.' and '..' (and possibly other .* files) |