From 998da918d9ef90b0dfd5e484ba52aa40c89af9c9 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 26 Oct 2003 04:43:02 +0000 Subject: Fix gcc warnings. If NAME_MAX is 255, and d_namlen is a uint8_t, then d_namlen can never be > NAME_MAX. Stop gcc worrying about this by using a preprocessor test to see if NAME_MAX changes. --- sbin/restore/dirs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sbin/restore') diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c index 313b87b..e872504 100644 --- a/sbin/restore/dirs.c +++ b/sbin/restore/dirs.c @@ -349,8 +349,11 @@ putdir(char *buf, long size) i = DIRBLKSIZ - (loc & (DIRBLKSIZ - 1)); if ((dp->d_reclen & 0x3) != 0 || dp->d_reclen > i || - dp->d_reclen < DIRSIZ(0, dp) || - dp->d_namlen > NAME_MAX) { + dp->d_reclen < DIRSIZ(0, dp) +#if NAME_MAX < 255 + || dp->d_namlen > NAME_MAX +#endif + ) { vprintf(stdout, "Mangled directory: "); if ((dp->d_reclen & 0x3) != 0) vprintf(stdout, @@ -359,10 +362,12 @@ putdir(char *buf, long size) vprintf(stdout, "reclen less than DIRSIZ (%d < %d) ", dp->d_reclen, DIRSIZ(0, dp)); +#if NAME_MAX < 255 if (dp->d_namlen > NAME_MAX) vprintf(stdout, "reclen name too big (%d > %d) ", dp->d_namlen, NAME_MAX); +#endif vprintf(stdout, "\n"); loc += i; continue; -- cgit v1.1