diff --git a/configure.ac b/configure.ac index 6b052f24..af6f6918 100644 --- a/configure.ac +++ b/configure.ac @@ -34,19 +34,7 @@ AC_PROG_YACC gl_EARLY AC_CHECK_TOOLS([AR], [ar]) -AC_SYS_LARGEFILE - -AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h memory.h net/errno.h \ - sgtty.h string.h \ - sys/param.h sys/device.h sys/gentape.h \ - sys/inet.h sys/io/trioctl.h \ - sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \ - unistd.h locale.h) - -AC_CHECK_HEADERS([sys/buf.h], [], [], -[#if HAVE_SYS_PARAM_H -#include -#endif]) +AC_CHECK_HEADERS_ONCE([linux/fd.h sys/mtio.h]) AC_HEADER_MAJOR @@ -234,13 +222,7 @@ fi TAR_HEADERS_ATTR_XATTR_H -AC_CHECK_FUNCS_ONCE([fchmod fchown fsync lstat mkfifo readlink symlink]) - -AC_CHECK_DECLS([getgrgid],,, [#include ]) -AC_CHECK_DECLS([getpwuid],,, [#include ]) -AC_CHECK_DECLS([time],,, [#include ]) - -AC_REPLACE_FUNCS(waitpid) +AC_CHECK_FUNCS_ONCE([fchmod fchown fsync mkfifo waitpid]) AC_ARG_VAR([RSH], [Configure absolute path to default remote shell binary]) AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH, @@ -264,9 +246,7 @@ AC_CACHE_CHECK(for remote shell, tar_cv_path_RSH, fi done fi]) -if test $tar_cv_path_RSH = no; then - AC_CHECK_HEADERS(netdb.h) -else +if test $tar_cv_path_RSH != "no"; then AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$tar_cv_path_RSH", [Define to the full path of your rsh, if any.]) fi @@ -360,7 +340,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE, $DEFAULT_QUOTING_STYLE, # Iconv AM_ICONV -AC_CHECK_HEADERS(iconv.h) +AC_CHECK_HEADERS_ONCE([iconv.h]) AC_CHECK_TYPE(iconv_t,:, AC_DEFINE(iconv_t, int, [Conversion descriptor type]), diff --git a/gnulib.modules b/gnulib.modules index 48c0e4cb..0e6cec61 100644 --- a/gnulib.modules +++ b/gnulib.modules @@ -63,6 +63,7 @@ human idx inttostr inttypes +largefile lchown linkat localcharset diff --git a/lib/.gitignore b/lib/.gitignore index b1a5f865..1d0adc15 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -6,5 +6,4 @@ paxnames.c rmt-command.h rmt.h rtapelib.c -system-ioctl.h system.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 4f104b41..5df1ffb0 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -33,7 +33,6 @@ noinst_HEADERS = \ paxlib.h\ rmt.h\ system.h\ - system-ioctl.h\ wordsplit.h\ xattr-at.h @@ -41,7 +40,7 @@ libtar_a_SOURCES = \ paxerror.c paxexit-status.c paxlib.h paxnames.c \ rtapelib.c \ rmt.h \ - system.h system-ioctl.h \ + system.h \ wordsplit.c\ xattr-at.c diff --git a/lib/wordsplit.c b/lib/wordsplit.c index 82dfa9d0..604f02c7 100644 --- a/lib/wordsplit.c +++ b/lib/wordsplit.c @@ -193,7 +193,7 @@ wordsplit_init0 (struct wordsplit *wsp) wsp->ws_errno = 0; } -char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v"; +static char wordsplit_c_escape_tab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v"; static int wordsplit_init (struct wordsplit *wsp, const char *input, size_t len, @@ -2513,7 +2513,7 @@ wordsplit_get_words (struct wordsplit *ws, size_t *wordc, char ***wordv) return 0; } -const char *_wordsplit_errstr[] = { +static char const *const wordsplit_errstr[] = { N_("no error"), N_("missing closing quote"), N_("memory exhausted"), @@ -2524,16 +2524,15 @@ const char *_wordsplit_errstr[] = { N_("unbalanced parenthesis"), N_("globbing error") }; -int _wordsplit_nerrs = - sizeof (_wordsplit_errstr) / sizeof (_wordsplit_errstr[0]); +enum { wordsplit_nerrs = sizeof wordsplit_errstr / sizeof *wordsplit_errstr }; const char * wordsplit_strerror (struct wordsplit *ws) { if (ws->ws_errno == WRDSE_USERERR) return ws->ws_usererr; - if (ws->ws_errno < _wordsplit_nerrs) - return _wordsplit_errstr[ws->ws_errno]; + if (ws->ws_errno < wordsplit_nerrs) + return wordsplit_errstr[ws->ws_errno]; return N_("unknown error"); } diff --git a/src/buffer.c b/src/buffer.c index 9da6747a..5358a0b0 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -52,10 +52,14 @@ static int record_index; /* FIXME: The following variables should ideally be static to this module. However, this cannot be done yet. The cleanup continues! */ +extern union block *record_start; union block *record_start; /* start of record of archive */ +extern union block *record_end; union block *record_end; /* last+1 block of archive record */ +extern union block *current_block; union block *current_block; /* current block of archive */ enum access_mode access_mode; /* how do we handle the archive */ +extern off_t records_read; off_t records_read; /* number of records read from this archive */ off_t records_written; /* likewise, for records written */ extern off_t records_skipped; /* number of records skipped at the start diff --git a/src/compare.c b/src/compare.c index d99fba35..d08220a2 100644 --- a/src/compare.c +++ b/src/compare.c @@ -20,12 +20,16 @@ Written by John Gilmore, on 1987-04-30. */ #include -#include #if HAVE_LINUX_FD_H # include #endif +#if HAVE_SYS_MTIO_H +# include +# include +#endif + #include "common.h" #include #include @@ -267,7 +271,6 @@ diff_link (void) current_stat_info.link_name)); } -#ifdef HAVE_READLINK static void diff_symlink (void) { @@ -293,7 +296,6 @@ diff_symlink (void) if (linkbuf != buf) free (linkbuf); } -#endif static void diff_special (void) @@ -496,11 +498,9 @@ diff_archive (void) diff_link (); break; -#ifdef HAVE_READLINK case SYMTYPE: diff_symlink (); break; -#endif case CHRTYPE: case BLKTYPE: diff --git a/src/create.c b/src/create.c index bcb4a394..344bd6d3 100644 --- a/src/create.c +++ b/src/create.c @@ -1870,7 +1870,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) return allocated; } -#ifdef HAVE_READLINK else if (S_ISLNK (st->stat.st_mode)) { st->link_name = areadlinkat_with_size (parentfd, name, st->stat.st_size); @@ -1905,7 +1904,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) file_count_links (st); return allocated; } -#endif else if (S_ISCHR (st->stat.st_mode)) { type = CHRTYPE; diff --git a/src/delete.c b/src/delete.c index 8303415f..221a1dfb 100644 --- a/src/delete.c +++ b/src/delete.c @@ -37,6 +37,7 @@ extern off_t records_read; /* The number of records skipped at the start of the archive, when passing over members that are not deleted. */ +extern off_t records_skipped; off_t records_skipped; /* Move archive descriptor by COUNT records worth. If COUNT is diff --git a/src/extract.c b/src/extract.c index 41f8418f..5952bce2 100644 --- a/src/extract.c +++ b/src/extract.c @@ -1587,7 +1587,6 @@ extract_link (char *file_name, MAYBE_UNUSED int typeflag) static int extract_symlink (char *file_name, MAYBE_UNUSED int typeflag) { -#ifdef HAVE_SYMLINK bool interdir_made = false; if (! absolute_names_option @@ -1605,6 +1604,19 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag) return 0; case RECOVER_NO: + if (!implemented (errno)) + { + static bool warned; + if (!warned) + { + warned = true; + WARNOPT (WARN_SYMLINK_CAST, + (0, 0, + _("Attempting extraction of symbolic links" + " as hard links"))); + } + return extract_link (file_name, typeflag); + } symlink_error (current_stat_info.link_name, file_name); return -1; } @@ -1612,19 +1624,6 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag) set_stat (file_name, ¤t_stat_info, -1, 0, 0, SYMTYPE, false, AT_SYMLINK_NOFOLLOW); return 0; - -#else - static int warned_once; - - if (!warned_once) - { - warned_once = 1; - WARNOPT (WARN_SYMLINK_CAST, - (0, 0, - _("Attempting extraction of symbolic links as hard links"))); - } - return extract_link (file_name, typeflag); -#endif } #if S_IFCHR || S_IFBLK diff --git a/src/system.c b/src/system.c index eae0a17a..8da10833 100644 --- a/src/system.c +++ b/src/system.c @@ -16,7 +16,11 @@ with this program. If not, see . */ #include -#include + +#if HAVE_SYS_MTIO_H +# include +# include +#endif #include "common.h" #include @@ -69,7 +73,7 @@ mtioseek (bool count_files, off_t count) return false; } -#if MSDOS +#if !HAVE_WAITPID /* MingW, MSVC 14. */ bool sys_get_archive_stat (void)