diff options
Diffstat (limited to 'ext2fs')
-rw-r--r-- | ext2fs/ChangeLog | 10 | ||||
-rw-r--r-- | ext2fs/inode.c | 6 | ||||
-rw-r--r-- | ext2fs/pager.c | 3 |
3 files changed, 17 insertions, 2 deletions
diff --git a/ext2fs/ChangeLog b/ext2fs/ChangeLog index 76a167b7..2f4d0d67 100644 --- a/ext2fs/ChangeLog +++ b/ext2fs/ChangeLog @@ -1,3 +1,13 @@ +2000-12-21 Marcus Brinkmann <marcus@gnu.org> + + * pager.c: Include <errno.h>. + (create_disk_pager): Panic if malloc fails. + Reported by Igor Khavkine <i_khavki@alcor.concordia.ca>. + + * inode.c (diskfs_get_translator): If malloc fails, set err to ENOMEM. + Initialize err with 0, and return it at the end of the function. + Reported by Igor Khavkine <i_khavki@alcor.concordia.ca>. + 2000-12-02 Roland McGrath <roland@frob.com> * inode.c (write_all_disknodes): Call diskfs_set_node_times after diff --git a/ext2fs/inode.c b/ext2fs/inode.c index 248347e1..71b00705 100644 --- a/ext2fs/inode.c +++ b/ext2fs/inode.c @@ -707,7 +707,7 @@ diskfs_set_translator (struct node *np, const char *name, unsigned namelen, error_t diskfs_get_translator (struct node *np, char **namep, unsigned *namelen) { - error_t err; + error_t err = 0; daddr_t blkno; unsigned datalen; void *transloc; @@ -725,12 +725,14 @@ diskfs_get_translator (struct node *np, char **namep, unsigned *namelen) datalen = ((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] << 8); *namep = malloc (datalen); + if (!*namep) + err = ENOMEM; bcopy (transloc + 2, *namep, datalen); diskfs_end_catch_exception (); *namelen = datalen; - return 0; + return err; } /* The maximum size of a symlink store in the inode (including '\0'). */ diff --git a/ext2fs/pager.c b/ext2fs/pager.c index 07041b72..d79761b1 100644 --- a/ext2fs/pager.c +++ b/ext2fs/pager.c @@ -19,6 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <string.h> +#include <errno.h> #include <hurd/store.h> #include "ext2fs.h" @@ -772,6 +773,8 @@ void create_disk_pager (void) { struct user_pager_info *upi = malloc (sizeof (struct user_pager_info)); + if (!upi) + ext2_panic ("can't create disk pager: %s", strerror (errno)); upi->type = DISK; pager_bucket = ports_create_bucket (); diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, store->size, |