Use "size > INT32_MAX" rather than "size >= 0x80000000U" to check 2GB limit.

This commit is contained in:
tsutsui 2008-11-24 17:30:12 +00:00
parent a43d077c5c
commit ee70a0c964

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.24 2008/11/24 17:19:53 tsutsui Exp $ */
/* $NetBSD: inode.c,v 1.25 2008/11/24 17:30:12 tsutsui Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -63,7 +63,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.5 (Berkeley) 2/8/95";
#else
__RCSID("$NetBSD: inode.c,v 1.24 2008/11/24 17:19:53 tsutsui Exp $");
__RCSID("$NetBSD: inode.c,v 1.25 2008/11/24 17:30:12 tsutsui Exp $");
#endif
#endif /* not lint */
@ -127,7 +127,7 @@ inosize(struct ext2fs_dinode *dp)
if ((fs2h16(dp->e2di_mode) & IFMT) == IFREG)
size |= (u_int64_t)fs2h32(dp->e2di_dacl) << 32;
if (size >= 0x80000000U)
if (size > INT32_MAX)
(void)setlarge();
return size;
}
@ -137,10 +137,10 @@ inossize(struct ext2fs_dinode *dp, u_int64_t size)
{
if ((fs2h16(dp->e2di_mode) & IFMT) == IFREG) {
dp->e2di_dacl = h2fs32(size >> 32);
if (size >= 0x80000000U)
if (size > INT32_MAX)
if (!setlarge())
return;
} else if (size >= 0x80000000U) {
} else if (size > INT32_MAX) {
pfatal("TRYING TO SET FILESIZE TO %llu ON MODE %x FILE\n",
(unsigned long long)size, fs2h16(dp->e2di_mode) & IFMT);
return;