[Bug 1749] New: mknod allows more than one file type in the mode flags
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Thu Mar 3 06:01:38 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1749
Summary: mknod allows more than one file type in the mode flags
Product: RTEMS
Version: 4.10
Platform: All
OS/Version: RTEMS
Status: NEW
Severity: normal
Priority: P3
Component: filesystem
AssignedTo: chrisj at rtems.org
ReportedBy: chrisj at rtems.org
This is not allowed. The standard states:
The file type for path is OR'ed into the mode argument, and the application
shall select one of the following symbolic constants:
Name Description
S_IFIFO FIFO-special
S_IFCHR Character-special (non-portable)
S_IFDIR Directory (non-portable)
S_IFBLK Block-special (non-portable)
S_IFREG Regular (non-portable)
The mknod code also has:
if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) )
rtems_set_errno_and_return_minus_one( EINVAL );
and sys/stat.h has:
#define _IFMT 0170000 /* type of file */
#define _IFDIR 0040000 /* directory */
#define _IFCHR 0020000 /* character special */
#define _IFBLK 0060000 /* block special */
#define _IFREG 0100000 /* regular */
#define _IFLNK 0120000 /* symbolic link */
#define _IFSOCK 0140000 /* socket */
#define _IFIFO 0010000 /* fifo */
where:
#define S_IFMT _IFMT
#define S_IFDIR _IFDIR
#define S_IFCHR _IFCHR
#define S_IFBLK _IFBLK
#define S_IFREG _IFREG
#define S_IFLNK _IFLNK
#define S_IFSOCK _IFSOCK
#define S_IFIFO _IFIFO
Notice these values are not bit for masking together, that are values for the
S_IFMT field in the mode. For example S_IFDIR and S_IFBLK share bits and this
is why mkdir works.
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list