Changeset 5357e24 in rtems for cpukit/libcsupport/src/mknod.c


Ignore:
Timestamp:
Mar 3, 2011, 1:38:52 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.9
Children:
9ec55e63
Parents:
3601c29
Message:

2011-03-03 Chris Johns <chrisj@…>

PR 1749/filesystem

  • libcsupport/src/mknod.c: Fix the incorrect handling of the file type in the mode value o reject invalid types as per the standard.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/mknod.c

    r3601c29 r5357e24  
    4141  int                                 result;
    4242
    43   if ( !(mode & (S_IFREG|S_IFCHR|S_IFBLK|S_IFIFO) ) )
    44     rtems_set_errno_and_return_minus_one( EINVAL );
     43  /*
     44   * The file type is field within the mode. Check we have a sane mode set.
     45   */
     46  switch (mode & S_IFMT) {
     47    case S_IFDIR:
     48    case S_IFCHR:
     49    case S_IFBLK:
     50    case S_IFREG:
     51    case S_IFIFO:
     52      break;
     53    default:
     54      rtems_set_errno_and_return_minus_one( EINVAL );
     55  }
    4556
    4657  if ( S_ISFIFO(mode) )
Note: See TracChangeset for help on using the changeset viewer.