From owner-svn-src-all@freebsd.org Sat Jan 16 02:21:45 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E539A83D6F for ; Sat, 16 Jan 2016 02:21:45 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D639C1E76 for ; Sat, 16 Jan 2016 02:21:44 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wm0-x22d.google.com with SMTP id f206so49786553wmf.0 for ; Fri, 15 Jan 2016 18:21:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=v0Fvy3IkUhxZE8HsL/kcIzlNPDXoxjBX+Yk+Zu8PuG0=; b=WOa0scWC0ntgyERthYCZcoqLlKD9lI90v7VqO4Q3UvH6JtrUFr8Vu733v1PkkKzQZ/ 5yWKwczFlDe2GiKvVsvyF6x6fiL4CxB3Miwxe+ewlOZrSR0lDqXwVLx+EMNOywfQse4R u0P6QV5iy7R+8DvD4jA5yAhp0g0oJup4sr0sJu4X7V7Bd4JUQmnAoYX2K+FfeeOaZbWV SrTC7iTMtHOcYi1bE8bXPa0QLMdjfPIB1XsED3QbOUeQhvND8y4UNQNd6IpwfrIj4Fhm bO+g9r8UlgF/goqjA3/78c0Mn7exF65gVunVTXG54mQll4elLqQgaTdBUrk2/YWeJ8c+ lOJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=v0Fvy3IkUhxZE8HsL/kcIzlNPDXoxjBX+Yk+Zu8PuG0=; b=GHZIzKCJn+e3O4lPJgM/iTTeKMsyd2+Gl7ZoambJgcX66Tb2jwiTtDriHCmt8LwkO6 PUIMDQnjhY+xkZEcZqubXoPhC9NHOqsHvDGC8cZBqtU1eeJjb50SROFGxL1xJiqhtzfI t6Yjx6vDaD7AcLfVYa2G54XYDl5MAUCnW9h+X+khT06DGLehmGrFfoX9wY8PvlGNM0io 1fQ6g+gfI0/5/dVM+vRaklBYz83aGKaN2PHkmHsXkGYf0NErn24xR4LNkipgrkfJB6tM +yf7lzFbQi8xvckFOjsH10zEXjSawAOyhabrJlGHQWsyKJtffpR+Q0Yj48tmUinIGNGY s/5g== X-Gm-Message-State: ALoCoQnkSg0NFEGKfexfvGStkazXhQPUn1iEaT41+c2uWzad9OePQ5qhqlVmfXJx6XWx2GeEixm3QsFUQfEEXnuCFVSss/bBJg== X-Received: by 10.194.174.73 with SMTP id bq9mr12892941wjc.145.1452910902922; Fri, 15 Jan 2016 18:21:42 -0800 (PST) Received: from [10.10.1.58] (liv3d.labs.multiplay.co.uk. [82.69.141.171]) by smtp.gmail.com with ESMTPSA id w8sm12983972wjx.21.2016.01.15.18.21.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 15 Jan 2016 18:21:42 -0800 (PST) Subject: Re: svn commit: r294127 - head/tools/regression/sockets/zerosend To: Garrett Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201601160218.u0G2IaRW066902@repo.freebsd.org> From: Steven Hartland Message-ID: <5699A94A.8070209@multiplay.co.uk> Date: Sat, 16 Jan 2016 02:22:02 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <201601160218.u0G2IaRW066902@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jan 2016 02:21:45 -0000 The main params change seems a bit odd, wouldn't have expected that to be valid, shouldn't they just be flagged __unused? On 16/01/2016 02:18, Garrett Cooper wrote: > Author: ngie > Date: Sat Jan 16 02:18:36 2016 > New Revision: 294127 > URL: https://svnweb.freebsd.org/changeset/base/294127 > > Log: > Fix warnings with clang/gcc > > - Get rid of unused argc/argv variables in main > - Exit on failure with a return code of 1 instead of -1 with err/errx as a > return code of -1 is implementation dependent > - Bump WARNS to 6 > > MFC after: 5 days > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/tools/regression/sockets/zerosend/Makefile > head/tools/regression/sockets/zerosend/zerosend.c > Directory Properties: > head/ (props changed) > > Modified: head/tools/regression/sockets/zerosend/Makefile > ============================================================================== > --- head/tools/regression/sockets/zerosend/Makefile Sat Jan 16 02:15:13 2016 (r294126) > +++ head/tools/regression/sockets/zerosend/Makefile Sat Jan 16 02:18:36 2016 (r294127) > @@ -2,6 +2,6 @@ > > PROG= zerosend > MAN= > -WARNS?= 2 > +WARNS?= 6 > > .include > > Modified: head/tools/regression/sockets/zerosend/zerosend.c > ============================================================================== > --- head/tools/regression/sockets/zerosend/zerosend.c Sat Jan 16 02:15:13 2016 (r294126) > +++ head/tools/regression/sockets/zerosend/zerosend.c Sat Jan 16 02:18:36 2016 (r294127) > @@ -54,9 +54,9 @@ try_0send(const char *test, int fd) > ch = 0; > len = send(fd, &ch, 0, 0); > if (len < 0) > - err(-1, "%s: try_0send", test); > + err(1, "%s: try_0send", test); > if (len != 0) > - errx(-1, "%s: try_0send: returned %zd", test, len); > + errx(1, "%s: try_0send: returned %zd", test, len); > } > > static void > @@ -68,9 +68,9 @@ try_0write(const char *test, int fd) > ch = 0; > len = write(fd, &ch, 0); > if (len < 0) > - err(-1, "%s: try_0write", test); > + err(1, "%s: try_0write", test); > if (len != 0) > - errx(-1, "%s: try_0write: returned %zd", test, len); > + errx(1, "%s: try_0write: returned %zd", test, len); > } > > static void > @@ -87,24 +87,24 @@ setup_udp(const char *test, int *fdp) > sin.sin_port = htons(PORT1); > sock1 = socket(PF_INET, SOCK_DGRAM, 0); > if (sock1 < 0) > - err(-1, "%s: setup_udp: socket", test); > + err(1, "%s: setup_udp: socket", test); > if (bind(sock1, (struct sockaddr *)&sin, sizeof(sin)) < 0) > - err(-1, "%s: setup_udp: bind(%s, %d)", test, > + err(1, "%s: setup_udp: bind(%s, %d)", test, > inet_ntoa(sin.sin_addr), PORT1); > sin.sin_port = htons(PORT2); > if (connect(sock1, (struct sockaddr *)&sin, sizeof(sin)) < 0) > - err(-1, "%s: setup_udp: connect(%s, %d)", test, > + err(1, "%s: setup_udp: connect(%s, %d)", test, > inet_ntoa(sin.sin_addr), PORT2); > > sock2 = socket(PF_INET, SOCK_DGRAM, 0); > if (sock2 < 0) > - err(-1, "%s: setup_udp: socket", test); > + err(1, "%s: setup_udp: socket", test); > if (bind(sock2, (struct sockaddr *)&sin, sizeof(sin)) < 0) > - err(-1, "%s: setup_udp: bind(%s, %d)", test, > + err(1, "%s: setup_udp: bind(%s, %d)", test, > inet_ntoa(sin.sin_addr), PORT2); > sin.sin_port = htons(PORT1); > if (connect(sock2, (struct sockaddr *)&sin, sizeof(sin)) < 0) > - err(-1, "%s: setup_udp: connect(%s, %d)", test, > + err(1, "%s: setup_udp: connect(%s, %d)", test, > inet_ntoa(sin.sin_addr), PORT1); > > fdp[0] = sock1; > @@ -130,12 +130,12 @@ setup_tcp(const char *test, int *fdp) > sin.sin_port = htons(PORT1); > sock1 = socket(PF_INET, SOCK_STREAM, 0); > if (sock1 < 0) > - err(-1, "%s: setup_tcp: socket", test); > + err(1, "%s: setup_tcp: socket", test); > if (bind(sock1, (struct sockaddr *)&sin, sizeof(sin)) < 0) > - err(-1, "%s: bind(%s, %d)", test, inet_ntoa(sin.sin_addr), > + err(1, "%s: bind(%s, %d)", test, inet_ntoa(sin.sin_addr), > PORT1); > if (listen(sock1, -1) < 0) > - err(-1, "%s: listen", test); > + err(1, "%s: listen", test); > > /* > * Now connect to it, non-blocking so that we don't deadlock against > @@ -143,25 +143,25 @@ setup_tcp(const char *test, int *fdp) > */ > sock2 = socket(PF_INET, SOCK_STREAM, 0); > if (sock2 < 0) > - err(-1, "%s: setup_tcp: socket", test); > + err(1, "%s: setup_tcp: socket", test); > if (fcntl(sock2, F_SETFL, O_NONBLOCK) < 0) > - err(-1, "%s: setup_tcp: fcntl(O_NONBLOCK)", test); > + err(1, "%s: setup_tcp: fcntl(O_NONBLOCK)", test); > if (connect(sock2, (struct sockaddr *)&sin, sizeof(sin)) < 0 && > errno != EINPROGRESS) > - err(-1, "%s: setup_tcp: connect(%s, %d)", test, > + err(1, "%s: setup_tcp: connect(%s, %d)", test, > inet_ntoa(sin.sin_addr), PORT1); > > /* > * Now pick up the connection after sleeping a moment to make sure > * there's been time for some packets to go back and forth. > */ > - if (sleep(1) < 0) > - err(-1, "%s: sleep(1)", test); > + if (sleep(1) != 0) > + err(1, "%s: sleep(1)", test); > sock3 = accept(sock1, NULL, NULL); > if (sock3 < 0) > - err(-1, "%s: accept", test); > - if (sleep(1) < 0) > - err(-1, "%s: sleep(1)", test); > + err(1, "%s: accept", test); > + if (sleep(1) != 0) > + err(1, "%s: sleep(1)", test); > > FD_ZERO(&writefds); > FD_SET(sock2, &writefds); > @@ -171,11 +171,11 @@ setup_tcp(const char *test, int *fdp) > tv.tv_usec = 0; > ret = select(sock2 + 1, NULL, &writefds, &exceptfds, &tv); > if (ret < 0) > - err(-1, "%s: setup_tcp: select", test); > + err(1, "%s: setup_tcp: select", test); > if (FD_ISSET(sock2, &exceptfds)) > - errx(-1, "%s: setup_tcp: select: exception", test); > + errx(1, "%s: setup_tcp: select: exception", test); > if (!FD_ISSET(sock2, &writefds)) > - errx(-1, "%s: setup_tcp: select: not writable", test); > + errx(1, "%s: setup_tcp: select: not writable", test); > > close(sock1); > fdp[0] = sock2; > @@ -187,7 +187,7 @@ setup_udsstream(const char *test, int *f > { > > if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fdp) < 0) > - err(-1, "%s: setup_udsstream: socketpair", test); > + err(1, "%s: setup_udsstream: socketpair", test); > } > > static void > @@ -195,7 +195,7 @@ setup_udsdgram(const char *test, int *fd > { > > if (socketpair(PF_LOCAL, SOCK_DGRAM, 0, fdp) < 0) > - err(-1, "%s: setup_udsdgram: socketpair", test); > + err(1, "%s: setup_udsdgram: socketpair", test); > } > > static void > @@ -203,7 +203,7 @@ setup_pipe(const char *test, int *fdp) > { > > if (pipe(fdp) < 0) > - err(-1, "%s: setup_pipe: pipe", test); > + err(1, "%s: setup_pipe: pipe", test); > } > > static void > @@ -213,19 +213,19 @@ setup_fifo(const char *test, int *fdp) > int fd1, fd2; > > if (mkstemp(path) == -1) > - err(-1, "%s: setup_fifo: mktemp", test); > + err(1, "%s: setup_fifo: mktemp", test); > unlink(path); > > if (mkfifo(path, 0600) < 0) > - err(-1, "%s: setup_fifo: mkfifo(%s)", test, path); > + err(1, "%s: setup_fifo: mkfifo(%s)", test, path); > > fd1 = open(path, O_RDONLY | O_NONBLOCK); > if (fd1 < 0) > - err(-1, "%s: setup_fifo: open(%s, O_RDONLY)", test, path); > + err(1, "%s: setup_fifo: open(%s, O_RDONLY)", test, path); > > fd2 = open(path, O_WRONLY | O_NONBLOCK); > if (fd2 < 0) > - err(-1, "%s: setup_fifo: open(%s, O_WRONLY)", test, path); > + err(1, "%s: setup_fifo: open(%s, O_WRONLY)", test, path); > > fdp[0] = fd2; > fdp[1] = fd1; > @@ -242,7 +242,7 @@ close_both(int *fdp) > } > > int > -main(int argc, char *argv[]) > +main(void) > { > int fd[2]; > >