From d39fb70401cbb05b407a32fc7eec8542056b0ce5 Mon Sep 17 00:00:00 2001 From: Walter Lozano Date: Fri, 17 Dec 2021 22:44:09 -0300 Subject: [PATCH] Fix check for tape device In b6b423f0 a fallback in tar to stdio was implemented. However, the check for the tape device didn't interpret the correct value returned from access(). Fix the check to implement the fallback to stdio properly. Signed-off-by: Walter Lozano --- tar/bsdtar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tar/bsdtar.c b/tar/bsdtar.c index b55b4c6c0..75249d105 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -216,9 +216,9 @@ main(int argc, char **argv) #if defined(_PATH_DEFTAPE) if (bsdtar->filename == NULL) { #if defined(_WIN32) && !defined(__CYGWIN__) - int tapeExists = _access(_PATH_DEFTAPE, 0); + int tapeExists = !_access(_PATH_DEFTAPE, 0); #else - int tapeExists = access(_PATH_DEFTAPE, F_OK); + int tapeExists = !access(_PATH_DEFTAPE, F_OK); #endif if (tapeExists) { bsdtar->filename = _PATH_DEFTAPE; -- 2.47.2