summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex White <alex.white@oarcorp.com>2021-10-04 14:24:02 -0500
committerJoel Sherrill <joel@rtems.org>2021-10-04 17:18:13 -0500
commit772ffc070455bdfe7a5e0970bf34655e5cf51fb8 (patch)
tree4b0de156206aac88e8a249a166c9dd0cf1a5fea2
parent9c2cb68481635fa72b7c08644df70b3df037f430 (diff)
downloadrtems-772ffc070455bdfe7a5e0970bf34655e5cf51fb8.tar.bz2
testsuites/fstests: Fix uninitialized utimbuf structs
The utimbuf structs in fsimfsconfig01 and fsimfsconfig02 were being passed to utime uninitialized. This did not cause problems until utime was changed to use utimensat behind the scenes. Now that utimensat is called, the values of the utimbuf struct are checked, and EINVAL is set for invalid values. The utimebuf structs in these tests could contain invalid values since they are uninitialized. By zero-initializing the utimbuf structs, we ensure that they pass the checks in utimensat and that errno is set to the expected ENOTSUP.
-rw-r--r--testsuites/fstests/fsimfsconfig01/init.c2
-rw-r--r--testsuites/fstests/fsimfsconfig03/init.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/testsuites/fstests/fsimfsconfig01/init.c b/testsuites/fstests/fsimfsconfig01/init.c
index fd11329bf6..c3e4485e5f 100644
--- a/testsuites/fstests/fsimfsconfig01/init.c
+++ b/testsuites/fstests/fsimfsconfig01/init.c
@@ -39,7 +39,7 @@ static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
static void Init(rtems_task_argument arg)
{
- struct utimbuf times;
+ const struct utimbuf times = {0};
const char *generic = "generic";
const char *mnt = "mnt";
const char *dev = "device";
diff --git a/testsuites/fstests/fsimfsconfig03/init.c b/testsuites/fstests/fsimfsconfig03/init.c
index 32db1638f4..beccb0fe7b 100644
--- a/testsuites/fstests/fsimfsconfig03/init.c
+++ b/testsuites/fstests/fsimfsconfig03/init.c
@@ -38,7 +38,7 @@ static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
static void Init(rtems_task_argument arg)
{
- struct utimbuf times;
+ const struct utimbuf times = {0};
const char *generic = "generic";
const char *mnt = "mnt";
const char *dev = "device";