diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-11 10:51:21 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-10-18 11:11:24 +0200 |
commit | 4af18b34f4193eb1ffa0415d50f952aa781ef2da (patch) | |
tree | 7db7a5e7abf5386765588f147d5b22535bc01563 /testsuites | |
parent | bsp/atsam: Add const qualifier to AES_SetInput() (diff) | |
download | rtems-4af18b34f4193eb1ffa0415d50f952aa781ef2da.tar.bz2 |
Support O_DIRECTORY open() flag
Close #3545.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/psxtests/psxfile01/test.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c index 4f53c1de8a..dbdce86be8 100644 --- a/testsuites/psxtests/psxfile01/test.c +++ b/testsuites/psxtests/psxfile01/test.c @@ -130,6 +130,29 @@ void stat_a_file( } +static void test_open_directory(void) +{ + static const char file[] = "somefile"; + int status; + int fd; + + fd = open( file, O_CREAT, S_IRWXU ); + rtems_test_assert( fd >= 0 ); + + status = close( fd ); + rtems_test_assert( status == 0 ); + +#ifdef O_DIRECTORY + errno = 0; + fd = open( file, O_DIRECTORY, S_IRWXU ); + rtems_test_assert( fd == -1 ); + rtems_test_assert( errno == ENOTDIR ); +#endif + + status = unlink( file ); + rtems_test_assert( status == 0 ); +} + /* * Main entry point of the test */ @@ -161,6 +184,8 @@ int main( TEST_BEGIN(); + test_open_directory(); + /* * Grab the maximum size of an in-memory file. */ |