diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-09 15:24:59 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-04-09 15:24:59 +0300 |
commit | b03f6cd3ebadd675f2cc9d518cb26fa860269447 (patch) | |
tree | 36f1d1a7ffdedd7c1e31c9b2447d0326d711ffa6 /src | |
parent | xz: Minor internal changes to handling of --threads. (diff) | |
download | xz-b03f6cd3ebadd675f2cc9d518cb26fa860269447.tar.xz |
xz: Avoid unneeded fstat() on DOS-like systems.
Diffstat (limited to 'src')
-rw-r--r-- | src/xz/file_io.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/xz/file_io.c b/src/xz/file_io.c index 56acf3bd..5eba9d87 100644 --- a/src/xz/file_io.c +++ b/src/xz/file_io.c @@ -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 defined(__VMS) + // If fstat() really fails, we have a safe fallback here. +# if defined(__VMS) pair->dest_st.st_ino[0] = 0; pair->dest_st.st_ino[1] = 0; pair->dest_st.st_ino[2] = 0; -#elif !defined(TUKLIB_DOSLIKE) +# else pair->dest_st.st_dev = 0; pair->dest_st.st_ino = 0; -#endif -#ifndef TUKLIB_DOSLIKE +# endif } else if (try_sparse && opt_mode == MODE_DECOMPRESS) { // When writing to standard output, we need to be extra // careful: @@ -689,8 +691,8 @@ io_open_dest_real(file_pair *pair) } pair->dest_try_sparse = true; -#endif } +#endif return false; } |