archive_set_error(&(a->archive), EINVAL, "pathname is empty");
return (ARCHIVE_FAILED);
}
- if (stat(path, &st) != 0) {
+ if (la_stat(path, &st) != 0) {
archive_set_error(&(a->archive), errno, "Failed to stat()");
return (ARCHIVE_FAILED);
}
* either Windows or Posix APIs. */
#if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
#include "archive_windows.h"
+#else
+#define la_stat(path,stref) stat(path,stref)
#endif
/*
}
} else
#endif
- if (stat(path, &s) != 0) {
+ if (la_stat(path, &s) != 0) {
archive_set_error(&a->archive, errno,
"Can't stat %s", path);
return (ARCHIVE_FAILED);
#else
if (tree_enter_working_dir(t) != 0)
return NULL;
- if (stat(tree_current_access_path(t), &t->st) != 0)
+ if (la_stat(tree_current_access_path(t), &t->st) != 0)
#endif
return NULL;
t->flags |= hasStat;
temp_name.s[temp_name.length-1] = '\0';
temp_name.length --;
}
- if (stat(temp_name.s, &st) < 0)
+ if (la_stat(temp_name.s, &st) < 0)
goto exit_tmpfile;
if (!S_ISDIR(st.st_mode)) {
errno = ENOTDIR;
#if !defined(__BORLANDC__) && !defined(__WATCOMC__)
#define setmode _setmode
#endif
-#ifdef stat
-#undef stat
-#endif
-#define stat(path,stref) __la_stat(path,stref)
+#define la_stat(path,stref) __la_stat(path,stref)
#if !defined(__WATCOMC__)
#if !defined(__BORLANDC__)
#define strdup _strdup
* follow the symlink if we're creating a dir.
*/
if (S_ISDIR(a->mode))
- r = stat(a->name, &a->st);
+ r = la_stat(a->name, &a->st);
/*
* If it's not a dir (or it's a broken symlink),
* then don't follow it.
#ifdef HAVE_LSTAT
r = lstat(a->name, &st);
#else
- r = stat(a->name, &st);
+ r = la_stat(a->name, &st);
#endif
if (r != 0)
r = errno;
* This is needed to extract hardlinks over
* symlinks.
*/
- r = stat(head, &st);
+ r = la_stat(head, &st);
if (r != 0) {
tail[0] = c;
if (errno == ENOENT) {
* here loses the ability to extract through symlinks. Also note
* that this should not use the a->st cache.
*/
- if (stat(path, &st) == 0) {
+ if (la_stat(path, &st) == 0) {
if (S_ISDIR(st.st_mode))
return (ARCHIVE_OK);
if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) {
* don't add it to the fixup list here, as it's already been
* added.
*/
- if (stat(path, &st) == 0 && S_ISDIR(st.st_mode))
+ if (la_stat(path, &st) == 0 && S_ISDIR(st.st_mode))
return (ARCHIVE_OK);
archive_set_error(&a->archive, errno, "Failed to create dir '%s'",