Changeset 508 for trunk/src/gmake/w32/pathstuff.c
- Timestamp:
- Sep 15, 2006, 9:06:56 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/w32/pathstuff.c
r503 r508 233 233 } 234 234 235 /* Workaround for directory names with trailing slashes. */ 236 int 237 stat(const char *path, struct stat *st) 238 { 239 int rc = _stat(path, st); 240 if ( rc != 0 241 && errno == ENOENT 242 && *path != '\0') 243 { 244 char *slash = strchr(path, '\0') - 1; 245 if (*slash == '/' || *slash == '\\') 246 { 247 size_t len_path = slash - path + 1; 248 char *tmp = alloca(len_path + 4); 249 memcpy(tmp, path, len_path); 250 tmp[len_path] = '.'; 251 tmp[len_path + 1] = '\0'; 252 errno = 0; 253 rc = _stat(tmp, st); 254 if ( rc == 0 255 && !S_ISDIR(st->st_mode)) 256 { 257 errno = ENOTDIR; 258 rc = -1; 259 } 260 } 261 } 262 return rc; 263 } 264 235 265 #ifdef unused 236 266 /*
Note:
See TracChangeset
for help on using the changeset viewer.