From 467596078fe7bce62eea7e3f34f6eef52a104f2f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 15 Jul 2012 19:30:38 -0300 Subject: [PATCH] tools: Avoid shadowing buffer variable --- tools/private-network-test.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/private-network-test.c b/tools/private-network-test.c index da0c88a..24f9234 100644 --- a/tools/private-network-test.c +++ b/tools/private-network-test.c @@ -176,15 +176,15 @@ int main(int argc, char *argv[]) * IP packet: src: 192.168.219.2 dst www.connman.net * HTTP GET / request */ - int buf[81] = { 0x45, 0x00, 0x00, 0x51, 0x5a, 0xbe, 0x00, 0x00, 0x40, - 0x06, 0x50, 0x73, 0xc0, 0xa8, 0xdb, 0x01, 0x3e, 0x4b, - 0xf5, 0x80, 0x30, 0x3b, 0x00, 0x50, 0x00, 0x00, 0x00, - 0x28, 0x04, 0xfd, 0xac, 0x9b, 0x50, 0x18, 0x02, 0x00, - 0xa1, 0xb3, 0x00, 0x00, 0x47, 0x45, 0x54, 0x20, 0x2f, - 0x20, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, - 0x0d, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x77, - 0x77, 0x77, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x6d, 0x61, - 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x0d, 0x0a, 0x0d, 0x0a}; + int buf1[81] = { 0x45, 0x00, 0x00, 0x51, 0x5a, 0xbe, 0x00, 0x00, 0x40, + 0x06, 0x50, 0x73, 0xc0, 0xa8, 0xdb, 0x01, 0x3e, 0x4b, + 0xf5, 0x80, 0x30, 0x3b, 0x00, 0x50, 0x00, 0x00, 0x00, + 0x28, 0x04, 0xfd, 0xac, 0x9b, 0x50, 0x18, 0x02, 0x00, + 0xa1, 0xb3, 0x00, 0x00, 0x47, 0x45, 0x54, 0x20, 0x2f, + 0x20, 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, + 0x0d, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x3a, 0x20, 0x77, + 0x77, 0x77, 0x2e, 0x63, 0x6f, 0x6e, 0x6e, 0x6d, 0x61, + 0x6e, 0x2e, 0x6e, 0x65, 0x74, 0x0d, 0x0a, 0x0d, 0x0a}; int buf2[81] = { 0x45, 0x00, 0x00, 0x51, 0x57, 0x9d, 0x00, 0x00, 0x40, @@ -220,12 +220,12 @@ int main(int argc, char *argv[]) if (!fork()) { - if (write(fd, buf, 81) < 0) { - fprintf(stderr, "err on write() buf\n"); + if (write(fd, buf1, sizeof(buf1)) < 0) { + fprintf(stderr, "err on write() buf1\n"); return -1; } - if (write(fd, buf2, 81) < 0) { + if (write(fd, buf2, sizeof(buf2)) < 0) { fprintf(stderr, "err on write() buf2\n"); return -1; } -- 2.7.4