Changeset 1321 in kBuild
- Timestamp:
- Dec 2, 2007 10:28:19 AM (17 years ago)
- Location:
- trunk/src/kmk/kmkbuiltin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/mscfakes.c
r1108 r1321 300 300 } 301 301 302 303 #undef stat 304 /* 305 * Workaround for directory names with trailing slashes. 306 * Added by bird reasons stated. 307 */ 308 int 309 my_other_stat(const char *path, struct stat *st) 310 { 311 int rc = stat(path, st); 312 if ( rc != 0 313 && errno == ENOENT 314 && *path != '\0') 315 { 316 char *slash = strchr(path, '\0') - 1; 317 if (*slash == '/' || *slash == '\\') 318 { 319 size_t len_path = slash - path + 1; 320 char *tmp = alloca(len_path + 4); 321 memcpy(tmp, path, len_path); 322 tmp[len_path] = '.'; 323 tmp[len_path + 1] = '\0'; 324 errno = 0; 325 rc = stat(tmp, st); 326 if ( rc == 0 327 && !S_ISDIR(st->st_mode)) 328 { 329 errno = ENOTDIR; 330 rc = -1; 331 } 332 } 333 } 334 return rc; 335 } 336 -
trunk/src/kmk/kmkbuiltin/mscfakes.h
r1309 r1321 41 41 # define fstat _fstat64 42 42 # define lseek _lseeki64 43 #else 44 # undef stat 45 # define stat(_path, _st) my_other_stat(_path, _st) 46 extern int my_other_stat(const char *, struct stat *); 43 47 #endif 48 44 49 45 50
Note:
See TracChangeset
for help on using the changeset viewer.