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.
This commit is contained in:
peter 2003-10-26 04:43:02 +00:00
parent 4550cc64c2
commit 998da918d9

View File

@ -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;