From 02faca19a73393d85e3875de9e4f349b4f839ee0 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 11 Jul 2006 13:37:32 +0000 Subject: 2006-07-11 Samuel Thibault * node.c (ftpfs_create_node): Check the result from hurd_ihash_add(). Add E to the hash table instead of NEW. --- ftpfs/ChangeLog | 5 +++++ ftpfs/node.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'ftpfs') diff --git a/ftpfs/ChangeLog b/ftpfs/ChangeLog index 4f042123..b9866ca9 100644 --- a/ftpfs/ChangeLog +++ b/ftpfs/ChangeLog @@ -1,3 +1,8 @@ +2006-07-11 Samuel Thibault + + * node.c (ftpfs_create_node): Check the result from hurd_ihash_add(). + Add E to the hash table instead of NEW. + 2005-06-14 Hugues Larrive * ftpfs.c (parse_startup_opt): User names may contain a @, so take diff --git a/ftpfs/node.c b/ftpfs/node.c index 1d15a686..d949016c 100644 --- a/ftpfs/node.c +++ b/ftpfs/node.c @@ -1,6 +1,6 @@ /* General fs node functions - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2006 Free Software Foundation, Inc. Written by Miles Bader This file is part of the GNU Hurd. @@ -39,6 +39,7 @@ ftpfs_create_node (struct ftpfs_dir_entry *e, const char *rmt_path, { struct node *new; struct netnode *nn = malloc (sizeof (struct netnode)); + error_t err; if (! nn) return ENOMEM; @@ -61,9 +62,16 @@ ftpfs_create_node (struct ftpfs_dir_entry *e, const char *rmt_path, ftpfs_maptime); spin_lock (&nn->fs->inode_mappings_lock); - hurd_ihash_add (&nn->fs->inode_mappings, e->stat.st_ino, new); + err = hurd_ihash_add (&nn->fs->inode_mappings, e->stat.st_ino, e); spin_unlock (&nn->fs->inode_mappings_lock); + if (err) + { + free (nn); + free (new); + return err; + } + e->node = new; *node = new; -- cgit v1.2.3