summaryrefslogtreecommitdiff
path: root/ext2fs/inode.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2001-01-07 17:03:55 +0000
committerMarcus Brinkmann <marcus@gnu.org>2001-01-07 17:03:55 +0000
commit58ef6ed22655adf4a797bedb85da862f872b10b8 (patch)
treed8ed3c5792662e964344adb1ab1154843c1b8c31 /ext2fs/inode.c
parentc39b618a82580064c268ac9c88b4fe414741a1ec (diff)
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>.
Diffstat (limited to 'ext2fs/inode.c')
-rw-r--r--ext2fs/inode.c6
1 files changed, 4 insertions, 2 deletions
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'). */