summaryrefslogtreecommitdiff
path: root/ext2fs
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-06-11 21:38:04 +0000
committerRoland McGrath <roland@gnu.org>2002-06-11 21:38:04 +0000
commitc28173526810463042aa91a629834eea511cedf1 (patch)
tree77bd806d3c0a6fe396385dea02ad5cad8be56b11 /ext2fs
parent68bac99171b5e8094677b58bac896d35d8da98a3 (diff)
2002-06-08 Roland McGrath <roland@frob.com>
* ialloc.c (diskfs_free_node): Use %Ld format for ino_t/off_t values. * pager.c (diskfs_grow, pager_unlock_page): Likewise. * inode.c (read_node): Likewise. * dir.c (diskfs_get_directs): Likewise. * dir.c (diskfs_direnter_hard): Use size_t for OLDSIZE. Fail with EOVERFLOW when it would exceed that width.
Diffstat (limited to 'ext2fs')
-rw-r--r--ext2fs/dir.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext2fs/dir.c b/ext2fs/dir.c
index 964240ba..4b085d14 100644
--- a/ext2fs/dir.c
+++ b/ext2fs/dir.c
@@ -411,7 +411,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx,
|| EXT2_DIR_REC_LEN (entry->name_len) > entry->rec_len
|| memchr (entry->name, '\0', entry->name_len))
{
- ext2_warning ("bad directory entry: inode: %d offset: %zd",
+ ext2_warning ("bad directory entry: inode: %Ld offset: %zd",
dp->cache_id,
currentoff - blockaddr + idx * DIRBLKSIZ);
return ENOENT;
@@ -531,7 +531,7 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
vm_address_t fromoff, tooff;
int totfreed;
error_t err;
- off_t oldsize = 0;
+ size_t oldsize = 0;
assert (ds->type == CREATE);
@@ -601,6 +601,12 @@ diskfs_direnter_hard (struct node *dp, const char *name, struct node *np,
assert (needed <= DIRBLKSIZ);
oldsize = dp->dn_stat.st_size;
+ if ((off_t)(oldsize + DIRBLKSIZ) != dp->dn_stat.st_size)
+ {
+ /* We can't possibly map the whole directory in. */
+ munmap ((caddr_t) ds->mapbuf, ds->mapextent);
+ return EOVERFLOW;
+ }
while (oldsize + DIRBLKSIZ > dp->allocsize)
{
err = diskfs_grow (dp, oldsize + DIRBLKSIZ, cred);
@@ -1049,7 +1055,7 @@ diskfs_get_directs (struct node *dp,
if (entryp->rec_len == 0)
{
- ext2_warning ("zero length directory entry: inode: %d offset: %zd",
+ ext2_warning ("zero length directory entry: inode: %Ld offset: %zd",
dp->cache_id,
blkno * DIRBLKSIZ + bufp - buf);
return EIO;
@@ -1063,7 +1069,7 @@ diskfs_get_directs (struct node *dp,
}
else if (bufp - buf > DIRBLKSIZ)
{
- ext2_warning ("directory entry too long: inode: %d offset: %zd",
+ ext2_warning ("directory entry too long: inode: %Ld offset: %zd",
dp->cache_id,
blkno * DIRBLKSIZ + bufp - buf - entryp->rec_len);
return EIO;