summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-27 11:56:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-11-27 12:46:17 +0100
commit06331e4dcb2495d323964cde4a5835110a6ed023 (patch)
tree7547b961a1713541b4e8b069b6f7bb8f292d9473
parentbsps/sparc: Add and use <grlib_impl.h> (diff)
downloadrtems-06331e4dcb2495d323964cde4a5835110a6ed023.tar.bz2
dosfs: Fix device identifier
Update #3358.
-rw-r--r--cpukit/libfs/src/dosfs/fat.c2
-rw-r--r--testsuites/fstests/fsdosfsname01/init.c41
2 files changed, 42 insertions, 1 deletions
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index cb45f91efe..8979065638 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -505,7 +505,7 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device)
rtems_set_errno_and_return_minus_one(ENXIO);
}
- vol->dev = stat_buf.st_dev;
+ vol->dev = stat_buf.st_rdev;
/* Read boot record */
/* FIXME: Asserts FAT_MAX_BPB_SIZE < bdbuf block size */
diff --git a/testsuites/fstests/fsdosfsname01/init.c b/testsuites/fstests/fsdosfsname01/init.c
index 90db282955..1785b6514e 100644
--- a/testsuites/fstests/fsdosfsname01/init.c
+++ b/testsuites/fstests/fsdosfsname01/init.c
@@ -29,6 +29,7 @@
#include <rtems/dosfs.h>
#include <rtems/ramdisk.h>
#include <rtems/libcsupport.h>
+#include <rtems/userenv.h>
#include "image.h"
#include "image_bin_le_singlebyte.h"
#include "image_bin_le_multibyte.h"
@@ -1143,6 +1144,44 @@ static void test_file_with_same_name_as_volume_label( void )
rtems_test_assert( rc == 0 );
}
+static void test_getcwd( void )
+{
+ const char *dir_path = MOUNT_DIR "/somedir";
+ char cwd_buf[128];
+ char *cwd;
+ int rc;
+ rtems_status_code sc;
+
+ sc = rtems_libio_set_private_env();
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+ cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+ rtems_test_assert( cwd != NULL );
+ rtems_test_assert( strcmp( cwd, "/" ) == 0 );
+
+ rc = mkdir( dir_path, S_IRWXU | S_IRWXG | S_IRWXO );
+ rtems_test_assert( rc == 0 );
+
+ rc = chdir( dir_path );
+ rtems_test_assert( rc == 0 );
+
+ cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+ rtems_test_assert( cwd != NULL );
+ rtems_test_assert( strcmp( cwd, dir_path ) == 0 );
+
+ rc = chdir( "/" );
+ rtems_test_assert( rc == 0 );
+
+ rc = unlink( dir_path );
+ rtems_test_assert( rc == 0 );
+
+ cwd = getcwd( cwd_buf, sizeof( cwd_buf ) );
+ rtems_test_assert( cwd != NULL );
+ rtems_test_assert( strcmp( cwd, "/" ) == 0 );
+
+ rtems_libio_use_global_env();
+}
+
static void test_special_cases( void )
{
test_end_of_string_matches();
@@ -1150,6 +1189,7 @@ static void test_special_cases( void )
test_full_8_3_name();
test_file_with_same_name_as_volume_label();
test_dir_with_same_name_as_volume_label();
+ test_getcwd();
}
/*
@@ -1397,6 +1437,7 @@ size_t rtems_ramdisk_configuration_size = RTEMS_ARRAY_SIZE(rtems_ramdisk_configu
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_SEMAPHORES (2 * RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE)
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK