X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftar.c;h=ab53cec684295d6c80f492dbd89de09bdf5f83fa;hb=de328a580ab6f5ff4a3237ce21f1ef0b7dd12984;hp=782ed3b5328a7778cb7afd786416803e5f3b0cbb;hpb=bad4b0006c872e09129cc1128ab24157af38b0cd;p=chaz%2Ftar diff --git a/src/tar.c b/src/tar.c index 782ed3b..ab53cec 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2465,6 +2465,14 @@ decode_options (int argc, char **argv) if (recursive_unlink_option) old_files_option = UNLINK_FIRST_OLD_FILES; + /* Flags for accessing files to be copied into. POSIX says + O_NONBLOCK has unspecified effect on most types of files, but in + practice it never harms and sometimes helps. */ + open_read_flags = + (O_RDONLY | O_BINARY | O_NOCTTY | O_NONBLOCK + | (dereference_option ? 0 : O_NOFOLLOW) + | (atime_preserve_option == system_atime_preserve ? O_NOATIME : 0)); + fstatat_flags = dereference_option ? 0 : AT_SYMLINK_NOFOLLOW; if (subcommand_option == TEST_LABEL_SUBCOMMAND) { @@ -2686,6 +2694,8 @@ tar_stat_destroy (struct tar_stat_info *st) free (st->gname); free (st->sparse_map); free (st->dumpdir); + if (0 < st->fd) + close (st->fd); xheader_destroy (&st->xhdr); memset (st, 0, sizeof (*st)); }