32 Commits
Author SHA1 Message Date
Tobias Stoeckmann 6338754d6a cpio: Simplify WINAPI_FAMILIY_PARTITION check
The macro is defined in archive_windows.h if missing.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2026-06-03 20:51:04 +02:00
Tim Kientzle 96f76577d3 Rename err.h to avoid conflict with system header
Depending on header search path ordering, we can easily
confuse libarchive_fe/err.h with the system header.
Rename ours to lafe_err.h to avoid the confusion.
Rename libarchive_fe/err.c to match.
2025-09-13 12:30:03 -07:00
Silent 14b8803c40 Fix a Y2038 bug by replacing Int32x32To64 with regular multiplication (#2471)
`Int32x32To64` macro internally truncates the arguments to int32, while
`time_t` is 64-bit on most/all modern platforms. Therefore, usage of
this macro creates a Year 2038 bug.

I detailed this issue a while ago in a writeup, and spotted the same
issue in this repository when updating the list of affected
repositories:
<https://cookieplmonster.github.io/2022/02/17/year-2038-problem/>

A few more notes:
1. I changed all uses of `Int32x32To64` en masse, even though at least
one of them was technically OK and used with int32 parameters only. IMO
better safe than sorry.
2. This is untested, but it's a small enough change that I hope the CI
success is a good enough indicator.
2025-01-01 08:31:35 -08:00
Emil Velikov 6287b99eb7 Convert the tools and respective tests to SPDX (#2317)
This is the first part of converting the project to use SPDX license
identifiers instead using the verbose license text.

The patches are semi-automated and I've went through manually to ensure
no license changes were made. That said, I would welcome another pair of
eyes, since I am only human.

See https://github.com/libarchive/libarchive/issues/2298

---------

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2024-10-12 20:54:16 -07:00
Brooks Davis 7dde502899 VCSid removal (#2017)
The libarchive source tree is littered with `__FBSDID("$FreeBSD.*")` and
'$FreeBSD$' tags left over from extracting it from FreeBSD's Subversion
repo. They never made sense for a git repo as git doesn't expand them
and FreeBSD has now removed `$FreeBSD$` from most local source files so
these stand out.

In addition to `__FBSDID` I've removed `__RCSID` which was used once for
a `$NetBSD$` expansion. There might be more of a case to be made for
preserving this one as a diff-reduction measure, but it seems mostly
pointless.

This builds and tests pass except for
libarchive_test_read_disk_directory_traversals which failed on master as
well.
2023-11-20 17:41:49 -08:00
Steve Lhomme 9e1081b9a8 Disable CreateFileA calls in UWP builds
Only CreateFile2 and CreateFileFromAppW are allowed.
2023-07-14 00:31:19 +02:00
Steve Lhomme 2aa73f8c94 Use CreateFile2 instead of CreateFileW on Win8+ builds
CreateFileW is not allowed in Universal Windows Platform (UWP) builds but
CreateFile2 is available. We could just enable this code for UWP but
it's probably to use it going forward so the code is properly tested on
both sides.
2023-07-14 00:31:19 +02:00
Michihiro NAKAJIMA 97d9cd37d0 Fix build failure in aggressive warnings on msys. 2012-02-16 13:17:12 +09:00
Michihiro NAKAJIMA d0a8792610 Eliminate warnings on Visual Studio 10 W64.
On Win64, the size of 'int' is stil 4 bytes and the size of 'size_t'
is 8 bytes. A conversion from 'size_t' to 'int', causes warning
with compiling.

SVN-Revision: 1772
2009-12-21 19:39:58 -05:00
Tim Kientzle b597f406e8 Not all Windows environments have sys/utime.h, so obey the configure check.
SVN-Revision: 1728
2009-12-12 19:00:52 -05:00
Tim Kientzle c8777373d0 Remove some code that's no longer used.
SVN-Revision: 1483
2009-10-05 01:02:06 -04:00
Tim Kientzle 92311cc128 Don't use la_ prefixes in non-libarchive code.
SVN-Revision: 1446
2009-09-10 00:32:57 -04:00
Tim Kientzle 04850cfd61 Remove some unused code; fix the build on MinGW.
SVN-Revision: 1445
2009-09-10 00:06:22 -04:00
Tim Kientzle 1ba43c6fb9 Remove some unused code.
SVN-Revision: 1436
2009-09-06 14:15:11 -04:00
Tim Kientzle f221d6530a Fix cpio build on MinGW if CreateHardLinkW is unavailable.
SVN-Revision: 1424
2009-09-04 22:48:51 -04:00
Charles Wilson 197cc2d1a2 Refine win32 api checks and usage.
* tar/bsdtar_windows.c: Remove WINVER, _WIN32_WINNT defines.
(wequallen): Remove unused function.
(canHardLinkW): Ditto.
* cpio/cpio_windows.c: Remove WINVER, _WIN32_WINNT defines.
* libarchive/archive_windows.c: Remove WINVER, _WIN32_WINNT defines.
* configure.ac [mingw|cygwin]: Add WINVER and _WIN32_WINNT defines
to config.h. Use new AC_CHECK_STDCALL_FUNC macro to check for
CreateHardLinkA symbol. Don't check for CreateSymbolicLink symbol.
* CMakeLists.txt [WIN32]: Add WINVER and _WIN32_WINNT defines to cache.
Check for CreateHardLinkA symbol, not CreateHardLink. Don't check for
CreateSymbolicLink.
* build/autoconf/check_stdcall_func.m4: New.

SVN-Revision: 1422
2009-09-04 02:11:54 -04:00
Tim Kientzle e089bb3f4a Fix a compile error on MinGW build.
SVN-Revision: 1350
2009-08-06 23:34:59 -04:00
Tim Kientzle 5b48250aca Fix bsdcpio build on VS9. There's still a minor build issue on MinGW that I need to track down. I think some of the cpio_windows.c shims aren't needed and can be removed.
SVN-Revision: 1349
2009-08-06 01:29:00 -04:00
Tim Kientzle b7faec8a56 Emulated sleep() is never used here.
SVN-Revision: 1345
2009-08-06 00:56:18 -04:00
Tim Kientzle 2171f3b622 Try to fix cpio_windows.c
SVN-Revision: 1330
2009-08-02 23:06:15 -04:00
Tim Kientzle 614fb568ee Remove the attempt to determine "root" for Windows in cpio.
This can never really work properly, so it's better to just
not bother.

SVN-Revision: 1239
2009-07-19 03:35:23 -04:00
Joerg Sonnenberger 71d1bfe0f4 Refactor common frontend code into a separate library.
SVN-Revision: 1118
2009-05-26 08:47:02 -04:00
Michihiro NAKAJIMA 926d6bcbad Revert r838,r839 and r840.
SVN-Revision: 842
2009-03-25 05:14:53 -04:00
Michihiro NAKAJIMA 63eafccd21 Remove useless '#ifndef LIST_H' condition.
SVN-Revision: 839
2009-03-24 05:29:24 -04:00
Michihiro NAKAJIMA 7dd9d16b20 Remove a lot of duplicate functions which simulates POSIX
function for Windows platform. And move the remaining
simulate functions to archive_windows.[ch].  It will be
easy maintenance and avoid the same named functions having
different codes. This change does *not* mean libarchive
library has those ones or exports it. All libarchive's
executable programs include archive_windows.c for one of
its program files.

SVN-Revision: 838
2009-03-24 05:04:15 -04:00
Charles Wilson 7d8aec6039 Issue 15, part 9. WINVER macro
When compiling with the w32api headers (used by mingw and cygwin)
  some symbols are not brought into scope by _WIN32_WINNT alone, but
  also require WINVER. Also, in *_cygwin.c files, change 0x500 to
  0x0500, for consistency with *_windows.c ones.

SVN-Revision: 816
2009-03-20 02:01:23 -04:00
Michihiro NAKAJIMA 75ba077d94 Back out r786 except cheking __CYGWIN__ macro.
SVN-Revision: 805
2009-03-19 00:00:51 -04:00
Charles Wilson f05e7741b8 Issue 15, part 3. Mechanical conversion of #defines, cpio/
#ifdef _WIN32   --> #if defined(_WIN32) && !defined(__CYGWIN__)
   #ifndef _WIN32  --> #if !defined(_WIN32) || defined(__CYGWIN__)
Exceptions to the general rule:
   cpio/test/main.c: some additional comments
   cpio/cpio.c: some additional comments

SVN-Revision: 789
2009-03-18 00:11:40 -04:00
Michihiro NAKAJIMA 525697361c Move _WIN32_WINNT macro to build/cmake/config.h.in
SVN-Revision: 786
2009-03-17 21:54:17 -04:00
Joerg Sonnenberger 411e8f1686 Be pedantic about argument range for ctype macros.
SVN-Revision: 750
2009-03-08 14:18:36 -04:00
Michihiro NAKAJIMA c0f0e5e43c On Windows, simulate POSIX stat. Add a reference count
of its parent directory to a link count of the directory.

SVN-Revision: 735
2009-03-06 08:02:36 -05:00
Michihiro NAKAJIMA a8c6b5d945 We can build bsdcpio on Windows. But it hasn't tested yet.
SVN-Revision: 729
2009-03-06 04:06:03 -05:00