This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-portability
in repository gfs2-utils.
commit 86269738dbe92ef2efbf59cc144b61284d1d6289
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Aug 18 17:21:37 2022 +0100
Remove dependency on linux/limits.h
The uses of PATH_MAX and NAME_MAX can be replaced by GFS2_FNAMESIZE in
some cases and just by declaring a sensibly sized string in another.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
configure.ac | 1 -
gfs2/fsck/main.c | 7 ++++---
gfs2/fsck/metawalk.c | 2 +-
gfs2/fsck/pass1.c | 2 +-
gfs2/libgfs2/libgfs2.h | 1 -
5 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index 11b9a66d..031d1014 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,7 +141,6 @@ AC_SUBST([testvol], [$with_testvol])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h sys/file.h
sys/ioctl.h sys/mount.h sys/time.h sys/vfs.h syslog.h termios.h])
-AC_CHECK_HEADER([linux/limits.h], [], [AC_MSG_ERROR([Unable to find linux/limits.h])])
# *FLAGS handling
ENV_CFLAGS="$CFLAGS"
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index 42114e53..fa8870c1 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -124,12 +124,13 @@ static int read_cmdline(int argc, char **argv, struct fsck_options
*gopts)
static void interrupt(int sig)
{
char response;
- char progress[PATH_MAX];
+ char progress[1024];
if (!last_reported_block || last_reported_block == last_fs_block)
- sprintf(progress, _("progress unknown.\n"));
+ snprintf(progress, sizeof(progress), _("progress unknown.\n"));
else
- sprintf(progress, _("processing block %"PRIu64" out of
%"PRIu64"\n"),
+ snprintf(progress, sizeof(progress),
+ _("processing block %"PRIu64" out of
%"PRIu64"\n"),
last_reported_block, last_fs_block);
response = generic_interrupt("fsck.gfs2", pass_name, progress,
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 9fb36aac..78adeb41 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -341,7 +341,7 @@ static int dirent_repair(struct lgfs2_inode *ip, struct
lgfs2_buffer_head *bh,
/* There can often be noise at the end, so only */
/* Trust the shorter of the two in case we have too much */
/* Or rather, only trust ours if it's shorter. */
- if (!d->dr_name_len || d->dr_name_len > NAME_MAX ||
+ if (!d->dr_name_len || d->dr_name_len > GFS2_FNAMESIZE ||
calc_de_name_len < d->dr_name_len) /* if dent is hosed */
d->dr_name_len = calc_de_name_len; /* use ours */
d->dr_rec_len = GFS2_DIRENT_SIZE(d->dr_name_len);
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index deac85cf..528a400b 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -181,7 +181,7 @@ static int resuscitate_dentry(struct fsck_cx *cx, struct lgfs2_inode
*ip, struct
{
struct lgfs2_sbd *sdp = ip->i_sbd;
struct lgfs2_dirent d;
- char tmp_name[PATH_MAX];
+ char tmp_name[GFS2_FNAMESIZE];
uint64_t block;
lgfs2_dirent_in(&d, dent);
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 77753bfc..34c9dfa1 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
-#include <linux/limits.h>
#include <endian.h>
#include <byteswap.h>
#include <mntent.h>
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date