Changeset 3825926 in rtems for testsuites


Ignore:
Timestamp:
Oct 18, 2018, 9:51:32 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1ad26cd
Parents:
92e0eed
git-author:
Sebastian Huber <sebastian.huber@…> (10/18/18 09:51:32)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/22/18 06:06:05)
Message:

Support O_CLOEXEC open() flag

Make sure this flag is ignored and does not prevent a successful open.

Close #3547.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxfile01/test.c

    r92e0eed r3825926  
    5858rtems_filesystem_operations_table  IMFS_ops_no_rename;
    5959
     60static const char somefile[] = "somefile";
     61
    6062/*
    6163 *  File test support routines.
     
    133135static void test_open_directory(void)
    134136{
    135   static const char file[] = "somefile";
    136137  int status;
    137138  int fd;
    138139
    139   fd = open( file, O_CREAT, S_IRWXU );
     140  fd = open( somefile, O_CREAT, S_IRWXU );
    140141  rtems_test_assert( fd >= 0 );
    141142
     
    145146#ifdef O_DIRECTORY
    146147  errno = 0;
    147   fd = open( file, O_DIRECTORY, S_IRWXU );
     148  fd = open( somefile, O_DIRECTORY, S_IRWXU );
    148149  rtems_test_assert( fd == -1 );
    149150  rtems_test_assert( errno == ENOTDIR );
    150151#endif
    151152
    152   status = unlink( file );
     153  status = unlink( somefile );
     154  rtems_test_assert( status == 0 );
     155}
     156
     157static void test_open_cloexec(void)
     158{
     159  int status;
     160  int fd;
     161  mode_t mode;
     162
     163  mode = O_CREAT;
     164
     165#ifdef O_CLOEXEC
     166  mode |= O_CLOEXEC;
     167#endif
     168
     169  fd = open( somefile, mode, S_IRWXU );
     170  rtems_test_assert( fd >= 0 );
     171
     172  status = close( fd );
     173  rtems_test_assert( status == 0 );
     174
     175  status = unlink( somefile );
    153176  rtems_test_assert( status == 0 );
    154177}
     
    186209
    187210  test_open_directory();
     211  test_open_cloexec();
    188212
    189213  /*
Note: See TracChangeset for help on using the changeset viewer.