about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2022-09-21 10:51:06 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-10-05 18:04:13 -0300
commitcbf24edbb3123e3154ad2366912e0c1270ad3546 (patch)
treec39c9c95b36f84e0540b99adaae79f2ec5869cee
parent442e3a21724b07b3ae1c3c5eeba4a8e44a1a50a3 (diff)
downloadglibc-cbf24edbb3123e3154ad2366912e0c1270ad3546.tar.gz
glibc-cbf24edbb3123e3154ad2366912e0c1270ad3546.tar.xz
glibc-cbf24edbb3123e3154ad2366912e0c1270ad3546.zip
rt: Initialize mq_send input on tst-mqueue{5,6}
GCC with -Os warns that the mq_send input may be used uninitialized.
Although for the tests the data content sent is not important, since
both tests checks only if mq_notify was properly set, the warning is
correct and data is indeed uninitialized.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--rt/tst-mqueue5.c2
-rw-r--r--rt/tst-mqueue6.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index 70d97a36c2..2b19b6a031 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -58,7 +58,7 @@ rtmin_handler (int sig, siginfo_t *info, void *ctx)
 static int
 (mqsend) (mqd_t q, int line)
 {
-  char c;
+  char c = 0;
   if (mq_send (q, &c, 1, 1) != 0)
     {
       printf ("mq_send on line %d failed with: %m\n", line);
diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c
index bc875f101e..a22ac05aca 100644
--- a/rt/tst-mqueue6.c
+++ b/rt/tst-mqueue6.c
@@ -40,7 +40,7 @@
 static int
 (mqsend) (mqd_t q, int line)
 {
-  char c;
+  char c = 0;
   if (mq_send (q, &c, 1, 1) != 0)
     {
       printf ("mq_send on line %d failed with: %m\n", line);