diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2009-07-09 10:14:42 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2009-07-09 10:14:42 +0000 |
commit | 338f5475bae32b467b0b1126358bfa42c23f3f2c (patch) | |
tree | bb6ac511458f407a05d0958a82a4aafc95b95faf /lib | |
parent | aad723e7325197f7e567c95c6deb146440d0f958 (diff) |
promote correct style for error checking
ok tedu@ deraadt@ krw@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/getaddrinfo.3 | 14 | ||||
-rw-r--r-- | lib/libc/sys/getdirentries.2 | 10 | ||||
-rw-r--r-- | lib/libc/sys/sigaltstack.2 | 6 |
3 files changed, 15 insertions, 15 deletions
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3 index 3e1f16d7832..7250407d659 100644 --- a/lib/libc/net/getaddrinfo.3 +++ b/lib/libc/net/getaddrinfo.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getaddrinfo.3,v 1.46 2009/05/06 19:03:09 jacekm Exp $ +.\" $OpenBSD: getaddrinfo.3,v 1.47 2009/07/09 10:14:41 eric Exp $ .\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $ .\" .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") @@ -16,7 +16,7 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 6 2009 $ +.Dd $Mdocdate: July 9 2009 $ .Dt GETADDRINFO 3 .Os .Sh NAME @@ -325,12 +325,12 @@ s = -1; for (res = res0; res; res = res->ai_next) { s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (s < 0) { + if (s == -1) { cause = "socket"; continue; } - if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { + if (connect(s, res->ai_addr, res->ai_addrlen) == -1) { cause = "connect"; save_errno = errno; close(s); @@ -341,7 +341,7 @@ for (res = res0; res; res = res->ai_next) { break; /* okay we got one */ } -if (s < 0) +if (s == -1) err(1, "%s", cause); freeaddrinfo(res0); .Ed @@ -368,12 +368,12 @@ nsock = 0; for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) { s[nsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (s[nsock] < 0) { + if (s[nsock] == -1) { cause = "socket"; continue; } - if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { + if (bind(s[nsock], res->ai_addr, res->ai_addrlen) == -1) { cause = "bind"; save_errno = errno; close(s[nsock]); diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index 42833263080..80fc06da0dd 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getdirentries.2,v 1.21 2007/05/31 19:19:32 jmc Exp $ +.\" $OpenBSD: getdirentries.2,v 1.22 2009/07/09 10:14:41 eric Exp $ .\" $NetBSD: getdirentries.2,v 1.7 1995/10/12 15:40:50 jtc Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)getdirentries.2 8.1 (Berkeley) 6/9/93 .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: July 9 2009 $ .Dt GETDIRENTRIES 2 .Os .Sh NAME @@ -154,9 +154,9 @@ char *path; struct stat sb; struct dirent *dp; -if ((fd = open(path, O_RDONLY)) < 0) +if ((fd = open(path, O_RDONLY)) == -1) err(2, "cannot open %s", path); -if (fstat(fd, &sb) < 0) +if (fstat(fd, &sb) == -1) err(2, "fstat"); bufsize = sb.st_size; if (bufsize < sb.st_blksize) @@ -173,7 +173,7 @@ while ((nbytes = getdirentries(fd, buf, bufsize, &base)) > 0) { cp += dp->d_reclen; } } -if (nbytes < 0) +if (nbytes == -1) err(2, "getdirentries"); free(buf); .Ed diff --git a/lib/libc/sys/sigaltstack.2 b/lib/libc/sys/sigaltstack.2 index 032f7f9be31..f01e1c316aa 100644 --- a/lib/libc/sys/sigaltstack.2 +++ b/lib/libc/sys/sigaltstack.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sigaltstack.2,v 1.13 2007/05/31 19:19:34 jmc Exp $ +.\" $OpenBSD: sigaltstack.2,v 1.14 2009/07/09 10:14:41 eric Exp $ .\" $NetBSD: sigaltstack.2,v 1.3 1995/02/27 10:41:52 cgd Exp $ .\" .\" Copyright (c) 1983, 1991, 1992, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93 .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: July 9 2009 $ .Dt SIGALTSTACK 2 .Os .Sh NAME @@ -110,7 +110,7 @@ if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL) /* error return */ sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; -if (sigaltstack(&sigstk,0) < 0) +if (sigaltstack(&sigstk, 0) == -1) perror("sigaltstack"); .Ed .Pp |