You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/06/02 10:27:43 UTC
cvs commit: apr/test testsock.c
jorton 2004/06/02 01:27:43
Modified: test testsock.c
Log:
* test/testsock.c (setup_socket): Return NULL if bind fails, fixing
test suite hang if port 8021 is in use; all callers updated. (come
back longjmp, all is forgiven).
Revision Changes Path
1.35 +8 -2 apr/test/testsock.c
Index: testsock.c
===================================================================
RCS file: /home/cvs/apr/test/testsock.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -d -w -u -r1.34 -r1.35
--- testsock.c 14 May 2004 14:43:22 -0000 1.34
+++ testsock.c 2 Jun 2004 08:27:43 -0000 1.35
@@ -85,6 +85,7 @@
rv = apr_socket_bind(sock, sa);
apr_assert_success(tc, "Problem binding to port", rv);
+ if (rv) return NULL;
rv = apr_socket_listen(sock, 5);
apr_assert_success(tc, "Problem listening on socket", rv);
@@ -97,6 +98,8 @@
apr_status_t rv;
apr_socket_t *sock = setup_socket(tc);
+ if (!sock) return;
+
rv = apr_socket_close(sock) ;
apr_assert_success(tc, "Problem closing socket", rv);
}
@@ -111,6 +114,7 @@
apr_size_t length;
sock = setup_socket(tc);
+ if (!sock) return;
launch_child(tc, &proc, "read", p);
@@ -143,6 +147,7 @@
char datastr[STRLEN];
sock = setup_socket(tc);
+ if (!sock) return;
launch_child(tc, &proc, "write", p);
@@ -175,6 +180,7 @@
int exit;
sock = setup_socket(tc);
+ if (!sock) return;
launch_child(tc, &proc, "read", p);
Re: cvs commit: apr/test testsock.c
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Wed, Jun 02, 2004 at 08:46:15AM -0400, rbb@rkbloom.net wrote:
>
>
> On 2 Jun 2004 jorton@apache.org wrote:
>
> > jorton 2004/06/02 01:27:43
> >
> > Modified: test testsock.c
> > Log:
> > * test/testsock.c (setup_socket): Return NULL if bind fails, fixing
> > test suite hang if port 8021 is in use; all callers updated. (come
> > back longjmp, all is forgiven).
>
> No, you were right the first time with regard to longjmp. The trade-off
> is that while using longjmp makes it easier to ignore the failure case, it
> also means you _can't_ cleanup after yourself in the case of an error.
I was half joking: removing the longjmp was a good long term goal, but
doing so *without* rewriting the test suite to take account of it just
means the test suite is now totally unreliable, it's hanging/segfaulting
in places where it wasn't before, which is quite frustrating.
All the _NOT_IMPL calls need to checked to see whether they need to have
a "return" too, for instance.
joe
Re: cvs commit: apr/test testsock.c
Posted by rb...@rkbloom.net.
On 2 Jun 2004 jorton@apache.org wrote:
> jorton 2004/06/02 01:27:43
>
> Modified: test testsock.c
> Log:
> * test/testsock.c (setup_socket): Return NULL if bind fails, fixing
> test suite hang if port 8021 is in use; all callers updated. (come
> back longjmp, all is forgiven).
No, you were right the first time with regard to longjmp. The trade-off
is that while using longjmp makes it easier to ignore the failure case, it
also means you _can't_ cleanup after yourself in the case of an error.
Ryan
Re: cvs commit: apr/test testsock.c
Posted by rb...@rkbloom.net.
On 2 Jun 2004 jorton@apache.org wrote:
> jorton 2004/06/02 01:27:43
>
> Modified: test testsock.c
> Log:
> * test/testsock.c (setup_socket): Return NULL if bind fails, fixing
> test suite hang if port 8021 is in use; all callers updated. (come
> back longjmp, all is forgiven).
No, you were right the first time with regard to longjmp. The trade-off
is that while using longjmp makes it easier to ignore the failure case, it
also means you _can't_ cleanup after yourself in the case of an error.
Ryan