xz: Avoid unneeded fstat() on DOS-like systems.

This commit is contained in:
Lasse Collin 2011-04-09 15:24:59 +03:00
parent 335fe260a8
commit b03f6cd3eb
1 changed files with 8 additions and 6 deletions

View File

@ -621,17 +621,19 @@ io_open_dest_real(file_pair *pair)
} }
} }
// If this really fails... well, we have a safe fallback. #ifndef TUKLIB_DOSLIKE
// dest_st isn't used on DOS-like systems except as a dummy
// argument to io_unlink(), so don't fstat() on such systems.
if (fstat(pair->dest_fd, &pair->dest_st)) { if (fstat(pair->dest_fd, &pair->dest_st)) {
// If fstat() really fails, we have a safe fallback here.
# if defined(__VMS) # if defined(__VMS)
pair->dest_st.st_ino[0] = 0; pair->dest_st.st_ino[0] = 0;
pair->dest_st.st_ino[1] = 0; pair->dest_st.st_ino[1] = 0;
pair->dest_st.st_ino[2] = 0; pair->dest_st.st_ino[2] = 0;
#elif !defined(TUKLIB_DOSLIKE) # else
pair->dest_st.st_dev = 0; pair->dest_st.st_dev = 0;
pair->dest_st.st_ino = 0; pair->dest_st.st_ino = 0;
# endif # endif
#ifndef TUKLIB_DOSLIKE
} else if (try_sparse && opt_mode == MODE_DECOMPRESS) { } else if (try_sparse && opt_mode == MODE_DECOMPRESS) {
// When writing to standard output, we need to be extra // When writing to standard output, we need to be extra
// careful: // careful:
@ -689,8 +691,8 @@ io_open_dest_real(file_pair *pair)
} }
pair->dest_try_sparse = true; pair->dest_try_sparse = true;
#endif
} }
#endif
return false; return false;
} }