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:
parent
4550cc64c2
commit
998da918d9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user