9
0
Fork 0

[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>
This commit is contained in:
Carsten Schlote 2008-02-15 20:26:45 +01:00 committed by Sascha Hauer
parent 7f266db949
commit c1bba7e226
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}