void *x_realloc(void *ptr, size_t size);
void x_setenv(const char *name, const char *value);
void x_unsetenv(const char *name);
-int x_fstat(int fd, struct stat *buf);
int x_lstat(const char *pathname, struct stat *buf);
int x_stat(const char *pathname, struct stat *buf);
void traverse(const char *dir, void (*fn)(const char *, struct stat *));
#endif
}
-// Like fstat() but also call cc_log on failure.
-int
-x_fstat(int fd, struct stat *buf)
-{
- int result = fstat(fd, buf);
- if (result != 0) {
- cc_log("Failed to fstat fd %d: %s", fd, strerror(errno));
- }
- return result;
-}
-
// Like lstat() but also call cc_log on failure.
int
x_lstat(const char *pathname, struct stat *buf)