diff options
| author | Dmitry V. Levin <ldv@altlinux.org> | 2013-05-08 14:03:38 +0000 |
|---|---|---|
| committer | Dmitry V. Levin <ldv@altlinux.org> | 2013-05-08 14:03:38 +0000 |
| commit | 56ef5ef90f23e1875247b1ee2b74549845c3eb63 (patch) | |
| tree | e54fa863a62e19b4949f01af93015c1b7c14572c /tests | |
| parent | 47b0dcca2b5ccb7e64a9de42d5d9d562e650bf17 (diff) | |
| download | strace-56ef5ef90f23e1875247b1ee2b74549845c3eb63.tar.gz strace-56ef5ef90f23e1875247b1ee2b74549845c3eb63.tar.bz2 strace-56ef5ef90f23e1875247b1ee2b74549845c3eb63.tar.xz | |
tests/net: fix portability issues
* tests/net-accept-connect.c: Fix address length passed to bind()
and connect().
* tests/net: Update regexps.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/net | 4 | ||||
| -rw-r--r-- | tests/net-accept-connect.c | 5 |
2 files changed, 5 insertions, 4 deletions
@@ -38,10 +38,10 @@ grep_log() grep_log socket '\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 0' grep_log socket '\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1' -grep_log bind '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="local-stream"\}, 110\) += 0' +grep_log bind '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="local-stream"\}, 15\) += 0' grep_log listen '\(0, 5\) += 0' grep_log getsockname '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="local-stream"\}, \[15\]\) += 0' grep_log accept '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), NULL\}, \[2\]\) += 1' -grep_log connect '\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="local-stream"\}, 110\) += 0' +grep_log connect '\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="local-stream"\}, 15\) += 0' exit 0 diff --git a/tests/net-accept-connect.c b/tests/net-accept-connect.c index 9d296f7..5af7d81 100644 --- a/tests/net-accept-connect.c +++ b/tests/net-accept-connect.c @@ -1,4 +1,5 @@ #include <assert.h> +#include <stddef.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> @@ -12,7 +13,7 @@ int main(void) .sun_family = AF_UNIX, .sun_path = SUN_PATH }; - socklen_t len = sizeof addr; + socklen_t len = offsetof(struct sockaddr_un, sun_path) + sizeof SUN_PATH; unlink(SUN_PATH); close(0); @@ -38,7 +39,7 @@ int main(void) } else { assert(socket(PF_LOCAL, SOCK_STREAM, 0) == 1); assert(close(0) == 0); - assert(connect(1, (struct sockaddr *) &addr, sizeof addr) == 0); + assert(connect(1, (struct sockaddr *) &addr, len) == 0); assert(close(1) == 0); return 0; } |
