about summary refs log tree commit diff
path: root/inet/tst-inet6_rth.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-03-15 19:16:16 +0000
committerUlrich Drepper <drepper@redhat.com>2009-03-15 19:16:16 +0000
commit906dd40db380c58794d252a112bd079b5d5f4dc6 (patch)
treeee74af4be50a937c9e6e7aad1b4184b93abaeca5 /inet/tst-inet6_rth.c
parent71a5bd3e177e7748cf8993b0577d65d8986b44bc (diff)
downloadglibc-906dd40db380c58794d252a112bd079b5d5f4dc6.tar.gz
glibc-906dd40db380c58794d252a112bd079b5d5f4dc6.tar.xz
glibc-906dd40db380c58794d252a112bd079b5d5f4dc6.zip
[BZ #9881]
	* inet/inet6_rth.c (inet6_rth_add): Add some error checking.
	Patch mostly by Yang Hongyang <yanghy@cn.fujitsu.com>.
	* inet/Makefile (tests): Add tst-inet6_rth.
	* inet/tst-inet6_rth.c: New file.

	alignment of La_x86_64_regs.  Store xmm parameters.
Diffstat (limited to 'inet/tst-inet6_rth.c')
-rw-r--r--inet/tst-inet6_rth.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/inet/tst-inet6_rth.c b/inet/tst-inet6_rth.c
new file mode 100644
index 0000000000..454a13f6b6
--- /dev/null
+++ b/inet/tst-inet6_rth.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <netinet/ip6.h>
+
+static int
+do_test (void)
+{
+  int res = 0;
+  char buf[1000];
+  void *p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 0);
+  if (p == NULL)
+    {
+      puts ("first inet6_rth_init failed");
+      res = 1;
+    }
+  else if (inet6_rth_add (p, &in6addr_any) == 0)
+    {
+      puts ("first inet6_rth_add succeeded");
+      res = 1;
+    }
+
+  p = inet6_rth_init (buf, 24, IPV6_RTHDR_TYPE_0, 1);
+  if (p == NULL)
+    {
+      puts ("second inet6_rth_init failed");
+      res = 1;
+    }
+  else if (inet6_rth_add (p, &in6addr_any) != 0)
+    {
+      puts ("second inet6_rth_add failed");
+      res = 1;
+    }
+  return res;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"