diff options
author | Carsten Schlote <c.schlote@konzeptpark.de> | 2008-02-15 20:26:45 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-02-19 09:28:17 +0100 |
commit | c1bba7e22696d4af1446c0d38675d077075953da (patch) | |
tree | 2b73d28653954589e550a3826ce9cadbdd3ab320 /fs | |
parent | 7f266db94966746cc07774b3c9b53c7368d7f15b (diff) | |
download | barebox-c1bba7e22696d4af1446c0d38675d077075953da.tar.gz barebox-c1bba7e22696d4af1446c0d38675d077075953da.tar.xz |
[general] Fixed crash in fs.h, when called with fsdrv.create == NULL
When a nor0 devices has no partitions assigned, then a call to
open() to create a file will jump with a NULL fct ptr.
Much more cheching code is missing and pointers to function are
jumped without any NULL ptr check. This must be fixed as well later.
Signed-off-by: Carsten Schlote <c.schlote@konzeptpark.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -406,8 +406,11 @@ int open(const char *pathname, int flags, ...) } if (!exist) { - errno = fsdrv->create(dev, path, - S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO); + if (NULL != fsdrv->create) + errno = fsdrv->create(dev, path, + S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO); + else + errno = -EROFS; if (errno) goto out; } |