]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
rt: Initialize mq_send input on tst-mqueue{5,6}
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Wed, 21 Sep 2022 13:51:06 +0000 (10:51 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 5 Oct 2022 21:04:13 +0000 (18:04 -0300)
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>
rt/tst-mqueue5.c
rt/tst-mqueue6.c

index 70d97a36c2e0171306c44a8ab4e0bea87fd4d3a3..2b19b6a0311a0a19d6c658429936b4d0d73a20b0 100644 (file)
@@ -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);
index bc875f101ef855cd33dd4497d9c1aa036e251d78..a22ac05acaec80a93fea00dbabe76e881b8ca7f5 100644 (file)
@@ -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);