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 | 155165974f8fbe5d448345e939792c5b30a20882 (patch) | |
| tree | 4df27a5057031d5f4ea27ceb70f98fa6b420cd55 /ufs | |
| parent | 890adb45a2f7f2abf357af3f36e6a88a99a9c7bc (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')
| -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); |
