summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-07-11 13:37:32 +0000
committerThomas Schwinge <tschwinge@gnu.org>2006-07-11 13:37:32 +0000
commit02faca19a73393d85e3875de9e4f349b4f839ee0 (patch)
tree5520323e8f3b8b7ca6df9c6461d1ac361ffe67c5
parent85b19fd8d03a57ba174cfc03153c8c255f6717d2 (diff)
2006-07-11 Samuel Thibault <samuel.thibault@ens-lyon.org>
* node.c (ftpfs_create_node): Check the result from hurd_ihash_add(). Add E to the hash table instead of NEW.
-rw-r--r--ftpfs/ChangeLog5
-rw-r--r--ftpfs/node.c12
2 files changed, 15 insertions, 2 deletions
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 <samuel.thibault@ens-lyon.org>
+
+ * 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 <hugues.larrive@gmail.com>
* 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 <miles@gnu.ai.mit.edu>
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;