|
|
a5a36d |
From 5396b6b77d0248678f716038dc747d6898acb0b3 Mon Sep 17 00:00:00 2001
|
|
|
a5a36d |
From: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
a5a36d |
Date: Fri, 22 Jan 2021 09:49:13 -0500
|
|
|
a5a36d |
Subject: [PATCH] Test for fsync on tty
|
|
|
a5a36d |
|
|
|
a5a36d |
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
|
|
a5a36d |
|
|
|
2d919c |
Modified for less 581.2 Filip Januš <fjanus@redhat.com>
|
|
|
2d919c |
diff -ur less-581.2/configure.ac less_fsync/configure.ac
|
|
|
2d919c |
--- less-581.2/configure.ac 2021-04-28 17:00:08.000000000 +0200
|
|
|
2d919c |
+++ less_fsync/configure.ac 2021-05-06 10:59:07.560062397 +0200
|
|
|
2d919c |
@@ -221,6 +221,8 @@
|
|
|
a5a36d |
[Define HAVE_TIME_T if your system supports the "time_t" type.])
|
|
|
a5a36d |
AH_TEMPLATE([HAVE_STRERROR],
|
|
|
a5a36d |
[Define HAVE_STRERROR if you have the strerror() function.])
|
|
|
a5a36d |
+AH_TEMPLATE([HAVE_FSYNC],
|
|
|
a5a36d |
+ [Define HAVE_FSYNC if fsync() on a tty works.])
|
|
|
a5a36d |
AH_TEMPLATE([HAVE_FILENO],
|
|
|
a5a36d |
[Define HAVE_FILENO if you have the fileno() macro.])
|
|
|
a5a36d |
AH_TEMPLATE([HAVE_ERRNO],
|
|
|
2d919c |
@@ -274,7 +276,7 @@
|
|
|
a5a36d |
|
|
|
a5a36d |
# Checks for library functions.
|
|
|
a5a36d |
AC_TYPE_SIGNAL
|
|
|
2d919c |
-AC_CHECK_FUNCS([fchmod fsync nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system ttyname usleep])
|
|
|
2d919c |
+AC_CHECK_FUNCS([fchmod nanosleep poll popen realpath _setjmp sigprocmask sigsetmask snprintf stat system ttyname usleep])
|
|
|
a5a36d |
|
|
|
a5a36d |
# AC_CHECK_FUNCS may not work for inline functions, so test these separately.
|
|
|
a5a36d |
AC_MSG_CHECKING(for memcpy)
|
|
|
2d919c |
@@ -321,6 +323,16 @@
|
|
|
a5a36d |
#endif], [static char *x; x = strerror(0);],
|
|
|
a5a36d |
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
|
|
|
a5a36d |
|
|
|
a5a36d |
+AC_MSG_CHECKING(for fsync)
|
|
|
a5a36d |
+AC_TRY_RUN([
|
|
|
a5a36d |
+#include <fcntl.h>
|
|
|
a5a36d |
+#include <unistd.h>
|
|
|
a5a36d |
+int main(void)
|
|
|
a5a36d |
+{
|
|
|
a5a36d |
+ int fd = open("/dev/tty", O_RDWR);
|
|
|
a5a36d |
+ return fsync(fd);
|
|
|
a5a36d |
+}], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FSYNC)], [AC_MSG_RESULT(no)])
|
|
|
a5a36d |
+
|
|
|
a5a36d |
AC_MSG_CHECKING(for sys_errlist)
|
|
|
a5a36d |
AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;],
|
|
|
a5a36d |
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
|