diff options
author | Roland McGrath <roland@gnu.org> | 2002-06-11 21:40:58 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-06-11 21:40:58 +0000 |
commit | e67c34f0cbacb31f56ad46510857acfe20c4db90 (patch) | |
tree | e1ad61105d8c3669798bd01e31528ff58f5a4758 /ufs/dir.c | |
parent | 6814a9338d1211625964ca3a702cd38e8708bc6f (diff) |
2002-06-08 Roland McGrath <roland@frob.com>
* dir.c (diskfs_direnter_hard): Use size_t for OLDSIZE.
Fail with EOVERFLOW when it would exceed that width.
* alloc.c, dir.c: Use %Ld format for ino_t values.
* alloc.c (diskfs_alloc_node): Use %Ld format for blkcnt_t values.
Diffstat (limited to 'ufs/dir.c')
-rw-r--r-- | ufs/dir.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -379,7 +379,7 @@ dirscanblock (vm_address_t blockaddr, struct node *dp, int idx, || DIRSIZ (DIRECT_NAMLEN (entry)) > read_disk_entry (entry->d_reclen) || memchr (entry->d_name, '\0', DIRECT_NAMLEN (entry))) { - fprintf (stderr, "Bad directory entry: inode: %d offset: %zd\n", + fprintf (stderr, "Bad directory entry: inode: %Ld offset: %zd\n", dp->dn->number, currentoff - blockaddr + idx * DIRBLKSIZ); return ENOENT; } @@ -502,7 +502,7 @@ diskfs_direnter_hard(struct node *dp, vm_address_t fromoff, tooff; int totfreed; error_t err; - off_t oldsize = 0; + size_t oldsize = 0; assert (ds->type == CREATE); @@ -585,6 +585,12 @@ diskfs_direnter_hard(struct node *dp, 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); |