]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check for tcgetattr / tcsetattr before using it for readpassphrase implementation...
authorJulian Uy <uyjulian@gmail.com>
Fri, 6 Dec 2024 15:58:58 +0000 (09:58 -0600)
committerGitHub <noreply@github.com>
Fri, 6 Dec 2024 15:58:58 +0000 (07:58 -0800)
This is mainly for non-cygwin newlib platforms that don't have tcgetattr
/ tcsetattr implemented

CMakeLists.txt
build/cmake/config.h.in
configure.ac
contrib/android/config/android.h
contrib/android/config/linux_host.h
contrib/android/config/windows_host.h
libarchive/config_freebsd.h
libarchive_fe/passphrase.c

index 8f38dd06449c2b6d0ab0e7d0bb2a0c9f52456682..9fd47412fb09905fe9af7f1720ac8a3c45298ed4 100644 (file)
@@ -1525,6 +1525,8 @@ CHECK_FUNCTION_EXISTS_GLIBC(strnlen HAVE_STRNLEN)
 CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR)
 CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK)
 CHECK_FUNCTION_EXISTS_GLIBC(sysconf HAVE_SYSCONF)
+CHECK_FUNCTION_EXISTS_GLIBC(tcgetattr HAVE_TCGETATTR)
+CHECK_FUNCTION_EXISTS_GLIBC(tcsetattr HAVE_TCSETATTR)
 CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM)
 CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET)
 CHECK_FUNCTION_EXISTS_GLIBC(unlinkat HAVE_UNLINKAT)
index c3c227e6d5f1de108ed89e00a61af74d1d6a65ed..ccfcc5be929a15e8f99c8a726e7e4f3b9425a525 100644 (file)
@@ -1175,6 +1175,12 @@ typedef uint64_t uintmax_t;
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 #cmakedefine HAVE_SYS_XATTR_H 1
 
+/* Define to 1 if you have the `tcgetattr' function. */
+#cmakedefine HAVE_TCGETATTR 1
+
+/* Define to 1 if you have the `tcsetattr' function. */
+#cmakedefine HAVE_TCSETATTR 1
+
 /* Define to 1 if you have the `timegm' function. */
 #cmakedefine HAVE_TIMEGM 1
 
index 6c7ed74efcfa47e8204646b193a48ff8174dccc1..5e620ae54b55ec40a948302fc613db4b6d5a9009 100644 (file)
@@ -835,6 +835,7 @@ AC_CHECK_FUNCS([readpassphrase])
 AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink])
 AC_CHECK_FUNCS([sysconf])
+AC_CHECK_FUNCS([tcgetattr tcsetattr])
 AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork])
 AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
 AC_CHECK_FUNCS([_fseeki64 _get_timezone])
index 0ccb20c4e8c4506d5725990a7e059f2d9ef87730..00fa4e9fdcfa5cb97d7b4164fdfc67f740761e27 100644 (file)
 #define HAVE_SYS_UTSNAME_H 1
 #define HAVE_SYS_VFS_H 1
 #define HAVE_SYS_WAIT_H 1
+#define HAVE_TCGETATTR 1
+#define HAVE_TCSETATTR 1
 #define HAVE_TIME_H 1
 #define HAVE_TZSET 1
 #define HAVE_UINTMAX_T 1
index 371c6cc480ad05ed251569b146f556bd898ae1f1..f0f7ab39ca178df789ffbbe54a00f08d6404fb18 100644 (file)
 #define HAVE_SYS_VFS_H 1
 #define HAVE_SYS_WAIT_H 1
 #define HAVE_SYS_XATTR_H 1
+#define HAVE_TCGETATTR 1
+#define HAVE_TCSETATTR 1
 #define HAVE_TIMEGM 1
 #define HAVE_TIME_H 1
 #define HAVE_TZSET 1
index 5210a4db5c7fd0081e3acc16e9b01a67ff1fc710..da821cc04a6d1f264e3a3ebe4ab3fc5fb7f098b1 100644 (file)
 /* Define to 1 if you have the <sys/xattr.h> header file. */
 /* #undef HAVE_SYS_XATTR_H */
 
+/* Define to 1 if you have the `tcgetattr' function. */
+/* #undef HAVE_TCGETATTR */
+
+/* Define to 1 if you have the `tcsetattr' function. */
+/* #undef HAVE_TCSETATTR */
+
 /* Define to 1 if you have the `timegm' function. */
 /* #undef HAVE_TIMEGM */
 
index a1bf0dfe9f793da67f301f0a4c7e7cbf0df765e2..5b36e1695de7e3f69b1e597324561e04370898a8 100644 (file)
 #define HAVE_SYS_TYPES_H 1
 #define HAVE_SYS_UTSNAME_H 1
 #define HAVE_SYS_WAIT_H 1
+#define HAVE_TCGETATTR 1
+#define HAVE_TCSETATTR 1
 #define HAVE_TIMEGM 1
 #define HAVE_TIME_H 1
 #define HAVE_TZSET 1
index 90fef32d254c9b43dda12e8e2068b145a2104222..527ad2d63654b70fba45ab53f01ed7f44aa2451a 100644 (file)
@@ -119,7 +119,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
        return (buf);
 }
 
-#else /* _WIN32 && !__CYGWIN__ */
+#elif defined(HAVE_TCGETATTR) && defined(HAVE_TCSETATTR)
 
 #include <assert.h>
 #include <ctype.h>
@@ -314,7 +314,13 @@ restart:
                errno = save_errno;
        return(nr == -1 ? NULL : buf);
 }
-#endif /* _WIN32 && !__CYGWIN__ */
+#else
+static char *
+readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
+{
+       return (NULL);
+}
+#endif
 #endif /* HAVE_READPASSPHRASE */
 
 char *