Resending due to line-wrapping issues

 echoes6 would segfault when the address couldn't be resolved, because
 it would try to read the address anyway. This patch makes it call
 exit() instead

Signed-off-by: Jiri Palecek <[email protected]>
---
 testcases/network/ipv6/echo6/echoes6.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/testcases/network/ipv6/echo6/echoes6.c 
b/testcases/network/ipv6/echo6/echoes6.c
index 4166aa2..2bea83b 100644
--- a/testcases/network/ipv6/echo6/echoes6.c
+++ b/testcases/network/ipv6/echo6/echoes6.c
@@ -41,10 +41,14 @@ main (int argc,char *argv[],char *env[])
        memset(&hints, 0, sizeof(hints));
        hints.ai_family = PF_INET6;
 
-       if ((gai=getaddrinfo(argv[1], NULL, &hints, &hp))!=0) 
-                fprintf(stderr, "Unknown subject address %s: %s\n", argv[1], 
gai_strerror(gai));                
-       if (!hp->ai_addr || hp->ai_addr->sa_family != AF_INET6)
-                fprintf(stderr, "getaddrinfo failed");
+       if ((gai=getaddrinfo(argv[1], NULL, &hints, &hp))!=0) {
+               fprintf(stderr, "Unknown subject address %s: %s\n", argv[1], 
gai_strerror(gai));
+               exit(1);
+       }
+       if (!hp->ai_addr || hp->ai_addr->sa_family != AF_INET6) {
+               fprintf(stderr, "getaddrinfo failed");
+               exit(1);
+       }
        if ((sp=getservbyname("echo","tcp"))==NULL) {
                printf("ERROR service is not available\n");
                perror("echo");
-- 
1.6.2.rc1




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to