about summary refs log tree commit diff
path: root/nss/bug17079.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2017-08-17 17:58:25 -0400
committerDJ Delorie <dj@redhat.com>2017-08-17 18:00:51 -0400
commita3fe6a20bf81ef6a97a761dac9050517e7fd7a1f (patch)
treec25c69106d240af6ba39471fab71e61cd512a1b3 /nss/bug17079.c
parentc22845744cd931267e0d7cb2e2b35a0da9c9510a (diff)
downloadglibc-a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f.tar.gz
glibc-a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f.tar.xz
glibc-a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f.zip
Update nss tests to new skeleton
* bug17079.c: Update to new test harness.
* test-digits-dots.c: Likewise.
* test-netdb.c: Likewise.
* tst-field.c: Likewise.
* tst-nss-getpwent.c: Likewise.
* tst-nss-static.c: Likewise.
* tst-nss-test1.c: Likewise.
* tst-nss-test2.c: Likewise.
* tst-nss-test3.c: Likewise.
* tst-nss-test4.c: Likewise.
* tst-nss-test5.c: Likewise.
Diffstat (limited to 'nss/bug17079.c')
-rw-r--r--nss/bug17079.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/nss/bug17079.c b/nss/bug17079.c
index 4171c7db55..09d33f018c 100644
--- a/nss/bug17079.c
+++ b/nss/bug17079.c
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <support/support.h>
+
 /* Check if two passwd structs contain the same data.  */
 static bool
 equal (const struct passwd *a, const struct passwd *b)
@@ -52,13 +54,13 @@ init_test_items (void)
       if (pwd == NULL)
         break;
       struct passwd *target = test_items + test_count;
-      target->pw_name = strdup (pwd->pw_name);
-      target->pw_passwd = strdup (pwd->pw_passwd);
+      target->pw_name = xstrdup (pwd->pw_name);
+      target->pw_passwd = xstrdup (pwd->pw_passwd);
       target->pw_uid = pwd->pw_uid;
       target->pw_gid = pwd->pw_gid;
-      target->pw_gecos = strdup (pwd->pw_gecos);
-      target->pw_dir = strdup (pwd->pw_dir);
-      target->pw_shell = strdup (pwd->pw_shell);
+      target->pw_gecos = xstrdup (pwd->pw_gecos);
+      target->pw_dir = xstrdup (pwd->pw_dir);
+      target->pw_shell = xstrdup (pwd->pw_shell);
     }
   while (++test_count < MAX_TEST_ITEMS);
   endpwent ();
@@ -108,13 +110,7 @@ static void
 test_one (const struct passwd *item, size_t buffer_size,
            char pad, size_t padding_size)
 {
-  char *buffer = malloc (buffer_size + padding_size);
-  if (buffer == NULL)
-    {
-      puts ("error: malloc failure");
-      errors = true;
-      return;
-    }
+  char *buffer = xmalloc (buffer_size + padding_size);
 
   struct passwd pwd;
   struct passwd *result;
@@ -240,5 +236,4 @@ do_test (void)
     return 0;
 }
 
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+#include <support/test-driver.c>