diff options
author | Chris Johns <chrisj@rtems.org> | 2011-03-03 06:22:48 +0000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2011-03-03 06:22:48 +0000 |
commit | 9a65833c1ea0471e5c39826fe117b9072007515a (patch) | |
tree | d22248d4dce4fd03d2bc994bc6d2094e80b905b2 /cpukit/libfs | |
parent | 2011-03-02 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-9a65833c1ea0471e5c39826fe117b9072007515a.tar.bz2 |
2011-03-03 Chris Johns <chrisj@rtems.org>
* libcsupport/src/mknod.c, libfs/src/rfs/rtems-rfs-inode.c: PR
1749. Fix the incorrect handling of the file type in the mode
value to reject invalid types as per the standard.
Diffstat (limited to 'cpukit/libfs')
-rw-r--r-- | cpukit/libfs/src/rfs/rtems-rfs-inode.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cpukit/libfs/src/rfs/rtems-rfs-inode.c b/cpukit/libfs/src/rfs/rtems-rfs-inode.c index 608048e84b..ab3f4b7e65 100644 --- a/cpukit/libfs/src/rfs/rtems-rfs-inode.c +++ b/cpukit/libfs/src/rfs/rtems-rfs-inode.c @@ -211,6 +211,21 @@ rtems_rfs_inode_create (rtems_rfs_file_system* fs, printf (" type:%s mode:%04x (%03o)\n", type, mode, mode & ((1 << 10) - 1)); } + /* + * The file type is field within the mode. Check we have a sane mode set. + */ + switch (mode & RTEMS_RFS_S_IFMT) + { + case RTEMS_RFS_S_IFDIR: + case RTEMS_RFS_S_IFCHR: + case RTEMS_RFS_S_IFBLK: + case RTEMS_RFS_S_IFREG: + case RTEMS_RFS_S_IFLNK: + break; + default: + return EINVAL; + } + rc = rtems_rfs_inode_alloc (fs, parent, ino); if (rc > 0) return rc; |