summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-27 11:58:22 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-27 11:58:22 +0200
commit2d02f7c0f007153ce883b9ab100b771c2b1bed65 (patch)
tree59170d30495a4f189a387ea3dddc674ecde31c78 /fs
parent06efc2b81a8f6567a24bb7d848ab444b1e17c422 (diff)
downloadbarebox-2d02f7c0f007153ce883b9ab100b771c2b1bed65.tar.gz
barebox-2d02f7c0f007153ce883b9ab100b771c2b1bed65.tar.xz
fix bug in ramfs when creating files whose parents do not exist
Diffstat (limited to 'fs')
-rw-r--r--fs/ramfs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ramfs.c b/fs/ramfs.c
index 80bb951e81..62093e4a35 100644
--- a/fs/ramfs.c
+++ b/fs/ramfs.c
@@ -216,8 +216,11 @@ int ramfs_create(struct device_d *dev, const char *pathname, mode_t mode)
char *file;
node = rlookup_parent(priv, pathname, &file);
- node_insert(node, file, mode);
- return 0;
+ if (node) {
+ node_insert(node, file, mode);
+ return 0;
+ }
+ return -ENOENT;
}
int ramfs_unlink(struct device_d *dev, const char *pathname)