Skip to content

Commit

Permalink
Fix reading procfs files on Linux: bad detection of HAVE_PROCFS.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed Sep 20, 2022
1 parent c69d0b5 commit 03f011f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions NEWS
Expand Up @@ -9,6 +9,18 @@
Report bugs, suggestions or comments at
https://github.com/gwsw/less/issues.

======================================================================

Major changes between "less" versions 608 and 609

* Fix ANSI color bug when overstriking with colored chars (github #276).

* Fix compiler const warning (github #279).

* Fix signal race in iread (github #280).

* Fix reading procfs files on Linux (github #282).

======================================================================

Major changes between "less" versions 590 and 608
Expand Down
3 changes: 3 additions & 0 deletions ch.c
Expand Up @@ -28,6 +28,9 @@ extern ino_t curr_ino;

#if HAVE_PROCFS
#include <sys/statfs.h>
#if HAVE_LINUX_MAGIC_H
#include <linux/magic.h>
#endif
#endif

typedef POSITION BLOCKNUM;
Expand Down
7 changes: 5 additions & 2 deletions configure.ac
Expand Up @@ -37,7 +37,7 @@ AC_SEARCH_LIBS([regcmp], [gen intl PW])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h])
AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h linux/magic.h sys/ioctl.h sys/stream.h wctype.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STAT
Expand Down Expand Up @@ -271,7 +271,10 @@ AC_TRY_COMPILE([#include <sys/types.h>
[struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for procfs)
AC_TRY_COMPILE([#include <sys/statfs.h>],
AC_TRY_COMPILE([#include <sys/statfs.h>
#if HAVE_LINUX_MAGIC_H
#include <linux/magic.h>
#endif],
[struct statfs s; s.f_type = PROC_SUPER_MAGIC; (void) fstatfs(0,&s); ],
[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_PROCFS)], [AC_MSG_RESULT(no)])

Expand Down

0 comments on commit 03f011f

Please sign in to comment.