]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2005-01-27 Jakub Jelinek <jakub@redhat.com>
authorRoland McGrath <roland@gnu.org>
Wed, 16 Feb 2005 10:37:06 +0000 (10:37 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 16 Feb 2005 10:37:06 +0000 (10:37 +0000)
[BZ #731]
* stdlib/tst-fmtmsg.c: Include stdlib.h.
2005-01-25  Jakub Jelinek  <jakub@redhat.com>

[BZ #731]
* stdlib/fmtmsg.c (addseverity): Remove new_string variable.
(free_mem): Don't free string.
* stdlib/tst-fmtmsg.c: Include string.h.
(main): Add some more tests.
2005-01-14  Ulrich Drepper  <drepper@redhat.com>

[BZ #731]
* stdlib/fmtmsg.c (internal_addseverity): Remove incorrect free call.
* stdlib/tst-fmtmsg.c (main): Add another addseverity test.

stdlib/tst-fmtmsg.c

index d5369bda621503fd7654262d39c17cb2a39cada7..c3748d64d5be3c964df47d76cd6226a2813f4d9a 100644 (file)
@@ -1,6 +1,8 @@
 #include <fmtmsg.h>
 #include <mcheck.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 
 #define MM_TEST 10
@@ -12,11 +14,13 @@ main (void)
 
   mtrace ();
 
-  if (addseverity (MM_TEST, "TEST") != MM_OK)
+  char TEST[] = "ABCD";
+  if (addseverity (MM_TEST, TEST) != MM_OK)
     {
       puts ("addseverity failed");
       result = 1;
     }
+  strcpy (TEST, "TEST");
 
   if (fmtmsg (MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt",
              "should print message for MM_HALT", "GLIBC:tst-fmtmsg:1")
@@ -48,5 +52,31 @@ main (void)
       != MM_OK)
     result = 1;
 
+  if (addseverity (MM_TEST, NULL) != MM_OK)
+    {
+      puts ("second addseverity failed");
+      result = 1;
+    }
+
+  if (addseverity (MM_TEST, NULL) != MM_NOTOK)
+    {
+      puts ("third addseverity unexpectedly succeeded");
+      result = 1;
+    }
+
+  char *p = strdup ("TEST2");
+  if (addseverity (MM_TEST, p) != MM_OK)
+    {
+      puts ("fourth addseverity failed");
+      result = 1;
+    }
+  if (addseverity (MM_TEST, "TEST3") != MM_OK)
+    {
+      puts ("fifth addseverity failed");
+      result = 1;
+    }
+
+  free (p);
+
   return result;
 }