summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/nc/netcat.c32
-rw-r--r--src/usr.bin/openssl/apps.c28
-rw-r--r--src/usr.bin/openssl/s_client.c6
-rw-r--r--src/usr.bin/openssl/s_server.c4
-rw-r--r--src/usr.bin/openssl/s_socket.c8
5 files changed, 39 insertions, 39 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 26288560b0..c2e769c4c0 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.204 2019/06/27 18:03:37 deraadt Exp $ */ 1/* $OpenBSD: netcat.c,v 1.205 2019/06/28 13:35:02 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * Copyright (c) 2015 Bob Beck. All rights reserved. 4 * Copyright (c) 2015 Bob Beck. All rights reserved.
@@ -568,7 +568,7 @@ main(int argc, char *argv[])
568 close(s); 568 close(s);
569 s = local_listen(host, uport, hints); 569 s = local_listen(host, uport, hints);
570 } 570 }
571 if (s < 0) 571 if (s == -1)
572 err(1, NULL); 572 err(1, NULL);
573 if (uflag && kflag) { 573 if (uflag && kflag) {
574 /* 574 /*
@@ -590,11 +590,11 @@ main(int argc, char *argv[])
590 len = sizeof(z); 590 len = sizeof(z);
591 rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK, 591 rv = recvfrom(s, buf, sizeof(buf), MSG_PEEK,
592 (struct sockaddr *)&z, &len); 592 (struct sockaddr *)&z, &len);
593 if (rv < 0) 593 if (rv == -1)
594 err(1, "recvfrom"); 594 err(1, "recvfrom");
595 595
596 rv = connect(s, (struct sockaddr *)&z, len); 596 rv = connect(s, (struct sockaddr *)&z, len);
597 if (rv < 0) 597 if (rv == -1)
598 err(1, "connect"); 598 err(1, "connect");
599 599
600 if (vflag) 600 if (vflag)
@@ -628,7 +628,7 @@ main(int argc, char *argv[])
628 tls_free(tls_cctx); 628 tls_free(tls_cctx);
629 } 629 }
630 if (family == AF_UNIX && uflag) { 630 if (family == AF_UNIX && uflag) {
631 if (connect(s, NULL, 0) < 0) 631 if (connect(s, NULL, 0) == -1)
632 err(1, "connect"); 632 err(1, "connect");
633 } 633 }
634 634
@@ -739,7 +739,7 @@ unix_bind(char *path, int flags)
739 739
740 /* Create unix domain socket. */ 740 /* Create unix domain socket. */
741 if ((s = socket(AF_UNIX, flags | (uflag ? SOCK_DGRAM : SOCK_STREAM), 741 if ((s = socket(AF_UNIX, flags | (uflag ? SOCK_DGRAM : SOCK_STREAM),
742 0)) < 0) 742 0)) == -1)
743 return -1; 743 return -1;
744 744
745 memset(&s_un, 0, sizeof(struct sockaddr_un)); 745 memset(&s_un, 0, sizeof(struct sockaddr_un));
@@ -752,7 +752,7 @@ unix_bind(char *path, int flags)
752 return -1; 752 return -1;
753 } 753 }
754 754
755 if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) { 755 if (bind(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
756 save_errno = errno; 756 save_errno = errno;
757 close(s); 757 close(s);
758 errno = save_errno; 758 errno = save_errno;
@@ -862,10 +862,10 @@ unix_connect(char *path)
862 int s, save_errno; 862 int s, save_errno;
863 863
864 if (uflag) { 864 if (uflag) {
865 if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) < 0) 865 if ((s = unix_bind(unix_dg_tmp_socket, SOCK_CLOEXEC)) == -1)
866 return -1; 866 return -1;
867 } else { 867 } else {
868 if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) 868 if ((s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1)
869 return -1; 869 return -1;
870 } 870 }
871 871
@@ -878,7 +878,7 @@ unix_connect(char *path)
878 errno = ENAMETOOLONG; 878 errno = ENAMETOOLONG;
879 return -1; 879 return -1;
880 } 880 }
881 if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) < 0) { 881 if (connect(s, (struct sockaddr *)&s_un, sizeof(s_un)) == -1) {
882 save_errno = errno; 882 save_errno = errno;
883 close(s); 883 close(s);
884 errno = save_errno; 884 errno = save_errno;
@@ -897,9 +897,9 @@ unix_listen(char *path)
897{ 897{
898 int s; 898 int s;
899 899
900 if ((s = unix_bind(path, 0)) < 0) 900 if ((s = unix_bind(path, 0)) == -1)
901 return -1; 901 return -1;
902 if (listen(s, 5) < 0) { 902 if (listen(s, 5) == -1) {
903 close(s); 903 close(s);
904 return -1; 904 return -1;
905 } 905 }
@@ -926,7 +926,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
926 926
927 for (res = res0; res; res = res->ai_next) { 927 for (res = res0; res; res = res->ai_next) {
928 if ((s = socket(res->ai_family, res->ai_socktype | 928 if ((s = socket(res->ai_family, res->ai_socktype |
929 SOCK_NONBLOCK, res->ai_protocol)) < 0) 929 SOCK_NONBLOCK, res->ai_protocol)) == -1)
930 continue; 930 continue;
931 931
932 /* Bind to a local port or source address if specified. */ 932 /* Bind to a local port or source address if specified. */
@@ -944,7 +944,7 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
944 errx(1, "getaddrinfo: %s", gai_strerror(error)); 944 errx(1, "getaddrinfo: %s", gai_strerror(error));
945 945
946 if (bind(s, (struct sockaddr *)ares->ai_addr, 946 if (bind(s, (struct sockaddr *)ares->ai_addr,
947 ares->ai_addrlen) < 0) 947 ares->ai_addrlen) == -1)
948 err(1, "bind failed"); 948 err(1, "bind failed");
949 freeaddrinfo(ares); 949 freeaddrinfo(ares);
950 } 950 }
@@ -1023,7 +1023,7 @@ local_listen(const char *host, const char *port, struct addrinfo hints)
1023 1023
1024 for (res = res0; res; res = res->ai_next) { 1024 for (res = res0; res; res = res->ai_next) {
1025 if ((s = socket(res->ai_family, res->ai_socktype, 1025 if ((s = socket(res->ai_family, res->ai_socktype,
1026 res->ai_protocol)) < 0) 1026 res->ai_protocol)) == -1)
1027 continue; 1027 continue;
1028 1028
1029 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x)); 1029 ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
@@ -1043,7 +1043,7 @@ local_listen(const char *host, const char *port, struct addrinfo hints)
1043 } 1043 }
1044 1044
1045 if (!uflag && s != -1) { 1045 if (!uflag && s != -1) {
1046 if (listen(s, 1) < 0) 1046 if (listen(s, 1) == -1)
1047 err(1, "listen"); 1047 err(1, "listen");
1048 } 1048 }
1049 if (vflag && s != -1) { 1049 if (vflag && s != -1) {
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index 2297b5bf2b..47e21265af 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.51 2019/02/09 15:49:21 inoguchi Exp $ */ 1/* $OpenBSD: apps.c,v 1.52 2019/06/28 13:35:02 deraadt Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -1377,7 +1377,7 @@ rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
1377 goto err; 1377 goto err;
1378 } 1378 }
1379 1379
1380 if (rename(serialfile, opath) < 0 && 1380 if (rename(serialfile, opath) == -1 &&
1381 errno != ENOENT && errno != ENOTDIR) { 1381 errno != ENOENT && errno != ENOTDIR) {
1382 BIO_printf(bio_err, "unable to rename %s to %s\n", 1382 BIO_printf(bio_err, "unable to rename %s to %s\n",
1383 serialfile, opath); 1383 serialfile, opath);
@@ -1386,11 +1386,11 @@ rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
1386 } 1386 }
1387 1387
1388 1388
1389 if (rename(npath, serialfile) < 0) { 1389 if (rename(npath, serialfile) == -1) {
1390 BIO_printf(bio_err, "unable to rename %s to %s\n", 1390 BIO_printf(bio_err, "unable to rename %s to %s\n",
1391 npath, serialfile); 1391 npath, serialfile);
1392 perror("reason"); 1392 perror("reason");
1393 if (rename(opath, serialfile) < 0) { 1393 if (rename(opath, serialfile) == -1) {
1394 BIO_printf(bio_err, "unable to rename %s to %s\n", 1394 BIO_printf(bio_err, "unable to rename %s to %s\n",
1395 opath, serialfile); 1395 opath, serialfile);
1396 perror("reason"); 1396 perror("reason");
@@ -1599,18 +1599,18 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix)
1599 goto err; 1599 goto err;
1600 } 1600 }
1601 1601
1602 if (rename(dbfile, odbpath) < 0 && errno != ENOENT && errno != ENOTDIR) { 1602 if (rename(dbfile, odbpath) == -1 && errno != ENOENT && errno != ENOTDIR) {
1603 BIO_printf(bio_err, "unable to rename %s to %s\n", 1603 BIO_printf(bio_err, "unable to rename %s to %s\n",
1604 dbfile, odbpath); 1604 dbfile, odbpath);
1605 perror("reason"); 1605 perror("reason");
1606 goto err; 1606 goto err;
1607 } 1607 }
1608 1608
1609 if (rename(dbpath, dbfile) < 0) { 1609 if (rename(dbpath, dbfile) == -1) {
1610 BIO_printf(bio_err, "unable to rename %s to %s\n", 1610 BIO_printf(bio_err, "unable to rename %s to %s\n",
1611 dbpath, dbfile); 1611 dbpath, dbfile);
1612 perror("reason"); 1612 perror("reason");
1613 if (rename(odbpath, dbfile) < 0) { 1613 if (rename(odbpath, dbfile) == -1) {
1614 BIO_printf(bio_err, "unable to rename %s to %s\n", 1614 BIO_printf(bio_err, "unable to rename %s to %s\n",
1615 odbpath, dbfile); 1615 odbpath, dbfile);
1616 perror("reason"); 1616 perror("reason");
@@ -1618,16 +1618,16 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix)
1618 goto err; 1618 goto err;
1619 } 1619 }
1620 1620
1621 if (rename(attrpath, oattrpath) < 0 && errno != ENOENT && errno != ENOTDIR) { 1621 if (rename(attrpath, oattrpath) == -1 && errno != ENOENT && errno != ENOTDIR) {
1622 BIO_printf(bio_err, "unable to rename %s to %s\n", 1622 BIO_printf(bio_err, "unable to rename %s to %s\n",
1623 attrpath, oattrpath); 1623 attrpath, oattrpath);
1624 perror("reason"); 1624 perror("reason");
1625 if (rename(dbfile, dbpath) < 0) { 1625 if (rename(dbfile, dbpath) == -1) {
1626 BIO_printf(bio_err, "unable to rename %s to %s\n", 1626 BIO_printf(bio_err, "unable to rename %s to %s\n",
1627 dbfile, dbpath); 1627 dbfile, dbpath);
1628 perror("reason"); 1628 perror("reason");
1629 } 1629 }
1630 if (rename(odbpath, dbfile) < 0) { 1630 if (rename(odbpath, dbfile) == -1) {
1631 BIO_printf(bio_err, "unable to rename %s to %s\n", 1631 BIO_printf(bio_err, "unable to rename %s to %s\n",
1632 odbpath, dbfile); 1632 odbpath, dbfile);
1633 perror("reason"); 1633 perror("reason");
@@ -1635,21 +1635,21 @@ rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix)
1635 goto err; 1635 goto err;
1636 } 1636 }
1637 1637
1638 if (rename(nattrpath, attrpath) < 0) { 1638 if (rename(nattrpath, attrpath) == -1) {
1639 BIO_printf(bio_err, "unable to rename %s to %s\n", 1639 BIO_printf(bio_err, "unable to rename %s to %s\n",
1640 nattrpath, attrpath); 1640 nattrpath, attrpath);
1641 perror("reason"); 1641 perror("reason");
1642 if (rename(oattrpath, attrpath) < 0) { 1642 if (rename(oattrpath, attrpath) == -1) {
1643 BIO_printf(bio_err, "unable to rename %s to %s\n", 1643 BIO_printf(bio_err, "unable to rename %s to %s\n",
1644 oattrpath, attrpath); 1644 oattrpath, attrpath);
1645 perror("reason"); 1645 perror("reason");
1646 } 1646 }
1647 if (rename(dbfile, dbpath) < 0) { 1647 if (rename(dbfile, dbpath) == -1) {
1648 BIO_printf(bio_err, "unable to rename %s to %s\n", 1648 BIO_printf(bio_err, "unable to rename %s to %s\n",
1649 dbfile, dbpath); 1649 dbfile, dbpath);
1650 perror("reason"); 1650 perror("reason");
1651 } 1651 }
1652 if (rename(odbpath, dbfile) < 0) { 1652 if (rename(odbpath, dbfile) == -1) {
1653 BIO_printf(bio_err, "unable to rename %s to %s\n", 1653 BIO_printf(bio_err, "unable to rename %s to %s\n",
1654 odbpath, dbfile); 1654 odbpath, dbfile);
1655 perror("reason"); 1655 perror("reason");
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c
index e542f08481..23bf67e695 100644
--- a/src/usr.bin/openssl/s_client.c
+++ b/src/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_client.c,v 1.37 2018/11/14 06:24:21 tb Exp $ */ 1/* $OpenBSD: s_client.c,v 1.38 2019/06/28 13:35:02 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -759,7 +759,7 @@ re_start:
759 if (SSL_version(con) == DTLS1_VERSION) { 759 if (SSL_version(con) == DTLS1_VERSION) {
760 760
761 sbio = BIO_new_dgram(s, BIO_NOCLOSE); 761 sbio = BIO_new_dgram(s, BIO_NOCLOSE);
762 if (getsockname(s, &peer, (void *) &peerlen) < 0) { 762 if (getsockname(s, &peer, (void *) &peerlen) == -1) {
763 BIO_printf(bio_err, "getsockname:errno=%d\n", 763 BIO_printf(bio_err, "getsockname:errno=%d\n",
764 errno); 764 errno);
765 shutdown(s, SHUT_RD); 765 shutdown(s, SHUT_RD);
@@ -1013,7 +1013,7 @@ re_start:
1013 tty_on,read_tty,write_tty,read_ssl,write_ssl);*/ 1013 tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
1014 1014
1015 i = poll(pfd, 3, ptimeout); 1015 i = poll(pfd, 3, ptimeout);
1016 if (i < 0) { 1016 if (i == -1) {
1017 BIO_printf(bio_err, "bad select %d\n", 1017 BIO_printf(bio_err, "bad select %d\n",
1018 errno); 1018 errno);
1019 goto shut; 1019 goto shut;
diff --git a/src/usr.bin/openssl/s_server.c b/src/usr.bin/openssl/s_server.c
index 4bdafaf682..a15795151f 100644
--- a/src/usr.bin/openssl/s_server.c
+++ b/src/usr.bin/openssl/s_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_server.c,v 1.30 2018/02/07 05:47:55 jsing Exp $ */ 1/* $OpenBSD: s_server.c,v 1.31 2019/06/28 13:35:02 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1512,7 +1512,7 @@ sv_body(char *hostname, int s, unsigned char *context)
1512 n = write(fileno(stdout), buf + len, i - len); 1512 n = write(fileno(stdout), buf + len, i - len);
1513 } while (n == -1 && errno == EINTR); 1513 } while (n == -1 && errno == EINTR);
1514 1514
1515 if (n < 0) { 1515 if (n == -1) {
1516 BIO_printf(bio_s_out, "ERROR\n"); 1516 BIO_printf(bio_s_out, "ERROR\n");
1517 goto err; 1517 goto err;
1518 } 1518 }
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index 62b32d3936..5d90fad8bb 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_socket.c,v 1.10 2018/08/19 20:07:06 tb Exp $ */ 1/* $OpenBSD: s_socket.c,v 1.11 2019/06/28 13:35:02 deraadt Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -107,7 +107,7 @@ init_client(int *sock, char *host, char *port, int type, int af)
107 i = 0; 107 i = 0;
108 i = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 108 i = setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
109 (char *) &i, sizeof(i)); 109 (char *) &i, sizeof(i));
110 if (i < 0) { 110 if (i == -1) {
111 perror("keepalive"); 111 perror("keepalive");
112 goto out; 112 goto out;
113 } 113 }
@@ -251,10 +251,10 @@ do_accept(int acc_sock, int *sock, char **host)
251 ling.l_onoff=1; 251 ling.l_onoff=1;
252 ling.l_linger=0; 252 ling.l_linger=0;
253 i=setsockopt(ret,SOL_SOCKET,SO_LINGER,(char *)&ling,sizeof(ling)); 253 i=setsockopt(ret,SOL_SOCKET,SO_LINGER,(char *)&ling,sizeof(ling));
254 if (i < 0) { perror("linger"); return(0); } 254 if (i == -1) { perror("linger"); return(0); }
255 i=0; 255 i=0;
256 i=setsockopt(ret,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); 256 i=setsockopt(ret,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
257 if (i < 0) { perror("keepalive"); return(0); } 257 if (i == -1) { perror("keepalive"); return(0); }
258*/ 258*/
259 259
260 if (host == NULL) 260 if (host == NULL)