Changeset 2592 in kBuild for trunk/src/kmk/w32
- Timestamp:
- Jun 17, 2012 10:50:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/w32/pathstuff.c
r2591 r2592 143 143 144 144 return p; 145 }146 147 #undef stat148 /*149 * Workaround for directory names with trailing slashes.150 * Added by bird reasons stated.151 */152 int153 my_stat(const char *path, struct stat *st)154 {155 int rc = stat(path, st);156 if ( rc != 0157 && errno == ENOENT158 && *path != '\0')159 {160 char *slash = strchr(path, '\0') - 1;161 if (*slash == '/' || *slash == '\\')162 {163 size_t len_path = slash - path + 1;164 char *tmp = alloca(len_path + 4);165 memcpy(tmp, path, len_path);166 tmp[len_path] = '.';167 tmp[len_path + 1] = '\0';168 errno = 0;169 rc = stat(tmp, st);170 if ( rc == 0171 && !S_ISDIR(st->st_mode))172 {173 errno = ENOTDIR;174 rc = -1;175 }176 }177 }178 #ifdef KMK_PRF179 {180 int err = errno;181 fprintf(stderr, "stat(%s,) -> %d/%d\n", path, rc, errno);182 errno = err;183 }184 #endif185 return rc;186 145 } 187 146
Note:
See TracChangeset
for help on using the changeset viewer.