summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-06-28 13:32:54 +0000
commit86ffccf24f66032a89d70a32b3609584c0db7345 (patch)
tree2ae97fac6ea5be57cc953baf8612e8f683da0172
parentce9fea47562d4f179d45680d6aec00ede2877141 (diff)
When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
-rw-r--r--distrib/special/more/more.c6
-rw-r--r--games/atc/log.c6
-rw-r--r--games/grdc/grdc.c4
-rw-r--r--games/hack/hack.bones.c8
-rw-r--r--games/hack/hack.do.c6
-rw-r--r--games/hack/hack.main.c8
-rw-r--r--games/hack/hack.pager.c4
-rw-r--r--games/hack/hack.save.c8
-rw-r--r--games/hack/hack.tty.c8
-rw-r--r--games/hack/makedefs.c6
-rw-r--r--games/hangman/ksyms.c6
-rw-r--r--games/hunt/hunt/list.c10
-rw-r--r--games/mille/save.c8
-rw-r--r--games/mille/varpush.c6
-rw-r--r--games/monop/execute.c4
-rw-r--r--games/phantasia/setup.c6
-rw-r--r--games/robots/main.c6
-rw-r--r--games/robots/score.c4
-rw-r--r--games/sail/misc.c4
-rw-r--r--games/sail/pl_1.c4
-rw-r--r--games/sail/sync.c6
-rw-r--r--games/snake/snake.c4
-rw-r--r--games/tetris/scores.c4
-rw-r--r--games/tetris/screen.c6
-rw-r--r--lib/libc/gen/alarm.c4
-rw-r--r--lib/libc/gen/auth_subr.c10
-rw-r--r--lib/libc/gen/authenticate.c6
-rw-r--r--lib/libc/gen/ftok.c4
-rw-r--r--lib/libc/gen/fts.c16
-rw-r--r--lib/libc/gen/getloadavg.c4
-rw-r--r--lib/libc/gen/getmntinfo.c10
-rw-r--r--lib/libc/gen/initgroups.c4
-rw-r--r--lib/libc/gen/login_cap.c14
-rw-r--r--lib/libc/gen/nlist.c6
-rw-r--r--lib/libc/gen/popen.c4
-rw-r--r--lib/libc/gen/posix_spawn.c4
-rw-r--r--lib/libc/gen/scandir.c6
-rw-r--r--lib/libc/gen/siginterrupt.c4
-rw-r--r--lib/libc/gen/signal.c4
-rw-r--r--lib/libc/gen/time.c4
-rw-r--r--lib/libc/gen/times.c6
-rw-r--r--lib/libc/gmon/gmon.c8
-rw-r--r--lib/libc/hash/helper.c8
-rw-r--r--lib/libc/locale/rune.c4
-rw-r--r--lib/libc/net/rcmdsh.c10
-rw-r--r--lib/libc/net/rresvport.c6
-rw-r--r--lib/libc/net/ruserok.c4
-rw-r--r--lib/libc/rpc/auth_unix.c4
-rw-r--r--lib/libc/rpc/bindresvport.c10
-rw-r--r--lib/libc/rpc/clnt_tcp.c6
-rw-r--r--lib/libc/rpc/clnt_udp.c8
-rw-r--r--lib/libc/rpc/pmap_rmt.c8
-rw-r--r--lib/libc/rpc/svc_tcp.c17
-rw-r--r--lib/libc/rpc/svc_udp.c4
-rw-r--r--lib/libc/rpc/xdr_stdio.c4
-rw-r--r--lib/libc/stdio/fdopen.c4
-rw-r--r--lib/libc/stdio/fopen.c4
-rw-r--r--lib/libc/stdio/fseek.c6
-rw-r--r--lib/libc/stdio/makebuf.c4
-rw-r--r--lib/libc/stdio/remove.c4
-rw-r--r--lib/libc/stdlib/malloc.c4
-rw-r--r--lib/libc/termios/tcgetpgrp.c4
-rw-r--r--lib/libc/termios/tcgetsid.c4
-rw-r--r--lib/libc/time/localtime.c4
-rw-r--r--lib/libedit/readline.c10
-rw-r--r--lib/libevent/evutil.c4
-rw-r--r--lib/libfuse/fuse.c8
-rw-r--r--lib/libkeynote/keynote-sign.c14
-rw-r--r--lib/libkeynote/keynote-sigver.c8
-rw-r--r--lib/libkeynote/keynote-verify.c20
-rw-r--r--lib/libkvm/kvm.c10
-rw-r--r--lib/libkvm/kvm_proc.c4
-rw-r--r--lib/libossaudio/ossaudio.c18
-rw-r--r--lib/libpcap/inet.c14
-rw-r--r--lib/libpcap/pcap-bpf.c34
-rw-r--r--lib/libsndio/sio_sun.c36
-rw-r--r--lib/libusbhid/descr.c4
-rw-r--r--lib/libutil/check_expire.c8
-rw-r--r--lib/libutil/getmaxpartitions.c4
-rw-r--r--lib/libutil/getrawpartition.c4
-rw-r--r--lib/libutil/logout.c4
-rw-r--r--lib/libutil/logwtmp.c4
-rw-r--r--lib/libutil/passwd.c4
-rw-r--r--lib/libutil/readlabel.c10
-rw-r--r--lib/libutil/uucplock.c10
-rw-r--r--libexec/fingerd/fingerd.c6
-rw-r--r--libexec/ftpd/ftpcmd.y10
-rw-r--r--libexec/ftpd/ftpd.c112
-rw-r--r--libexec/ftpd/logutmp.c4
-rw-r--r--libexec/ftpd/logwtmp.c4
-rw-r--r--libexec/ftpd/monitor.c4
-rw-r--r--libexec/ftpd/popen.c8
-rw-r--r--libexec/getty/main.c10
-rw-r--r--libexec/login_radius/raddauth.c4
-rw-r--r--libexec/login_skey/login_skey.c4
-rw-r--r--libexec/login_token/login_token.c4
-rw-r--r--libexec/login_token/tokendb.c4
-rw-r--r--libexec/mail.local/mail.local.c12
-rw-r--r--libexec/rpc.rquotad/rquotad.c8
-rw-r--r--libexec/rpc.rstatd/rstat_proc.c6
-rw-r--r--libexec/rpc.rstatd/rstatd.c4
-rw-r--r--libexec/rpc.rusersd/rusers_proc.c4
-rw-r--r--libexec/rpc.rusersd/rusersd.c4
-rw-r--r--libexec/rpc.rwalld/rwalld.c4
-rw-r--r--libexec/spamd/sync.c4
-rw-r--r--libexec/spamlogd/spamlogd.c4
-rw-r--r--libexec/talkd/announce.c4
-rw-r--r--libexec/talkd/talkd.c8
-rw-r--r--sbin/badsect/badsect.c8
-rw-r--r--sbin/bioctl/bioctl.c38
-rw-r--r--sbin/clri/clri.c4
-rw-r--r--sbin/dhclient/dhclient.c4
-rw-r--r--sbin/disklabel/disklabel.c4
-rw-r--r--sbin/dump/dumprmt.c4
-rw-r--r--sbin/dump/itime.c4
-rw-r--r--sbin/dump/main.c10
-rw-r--r--sbin/dump/tape.c16
-rw-r--r--sbin/dumpfs/dumpfs.c4
-rw-r--r--sbin/fsck/fsck.c6
-rw-r--r--sbin/fsck/fsutil.c10
-rw-r--r--sbin/fsck_ext2fs/setup.c10
-rw-r--r--sbin/fsck_ffs/setup.c10
-rw-r--r--sbin/fsck_msdos/check.c8
-rw-r--r--sbin/fsirand/fsirand.c16
-rw-r--r--sbin/growfs/growfs.c14
-rw-r--r--sbin/ifconfig/brconfig.c88
-rw-r--r--sbin/ifconfig/ifconfig.c190
-rw-r--r--sbin/iked/ocsp.c6
-rw-r--r--sbin/iked/parse.y8
-rw-r--r--sbin/init/init.c8
-rw-r--r--sbin/ipsecctl/pfkey.c4
-rw-r--r--sbin/isakmpd/if.c4
-rw-r--r--sbin/isakmpd/ike_auth.c10
-rw-r--r--sbin/isakmpd/monitor.c4
-rw-r--r--sbin/isakmpd/policy.c4
-rw-r--r--sbin/isakmpd/util.c4
-rw-r--r--sbin/isakmpd/virtual.c4
-rw-r--r--sbin/kbd/kbd_wscons.c12
-rw-r--r--sbin/ldattach/ldattach.c14
-rw-r--r--sbin/mknod/mknod.c4
-rw-r--r--sbin/mount/getmntopts.c4
-rw-r--r--sbin/mount/mount.c8
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c4
-rw-r--r--sbin/mount_ext2fs/mount_ext2fs.c4
-rw-r--r--sbin/mount_ffs/mount_ffs.c4
-rw-r--r--sbin/mount_msdos/mount_msdos.c4
-rw-r--r--sbin/mount_ntfs/mount_ntfs.c4
-rw-r--r--sbin/mount_udf/mount_udf.c6
-rw-r--r--sbin/mount_vnd/mount_vnd.c4
-rw-r--r--sbin/mountd/mountd.c10
-rw-r--r--sbin/ncheck_ffs/ncheck_ffs.c10
-rw-r--r--sbin/newfs/newfs.c22
-rw-r--r--sbin/newfs_ext2fs/newfs_ext2fs.c8
-rw-r--r--sbin/nfsd/nfsd.c24
-rw-r--r--sbin/nologin/nologin.c4
-rw-r--r--sbin/pfctl/pfctl.c90
-rw-r--r--sbin/pfctl/pfctl_optimize.c6
-rw-r--r--sbin/pfctl/pfctl_osfp.c8
-rw-r--r--sbin/pfctl/pfctl_parser.c4
-rw-r--r--sbin/pfctl/pfctl_queue.c6
-rw-r--r--sbin/pfctl/pfctl_radix.c32
-rw-r--r--sbin/pflogd/pflogd.c4
-rw-r--r--sbin/pflogd/privsep.c6
-rw-r--r--sbin/ping/ping.c50
-rw-r--r--sbin/quotacheck/quotacheck.c8
-rw-r--r--sbin/restore/dirs.c4
-rw-r--r--sbin/restore/symtab.c10
-rw-r--r--sbin/restore/tape.c14
-rw-r--r--sbin/restore/utilities.c14
-rw-r--r--sbin/savecore/savecore.c10
-rw-r--r--sbin/scan_ffs/scan_ffs.c8
-rw-r--r--sbin/slaacd/frontend.c19
-rw-r--r--sbin/slaacd/slaacd.c20
-rw-r--r--sbin/swapctl/swapctl.c14
-rw-r--r--sbin/swapctl/swaplist.c4
-rw-r--r--sbin/sysctl/sysctl.c24
-rw-r--r--sbin/umount/umount.c4
-rw-r--r--sbin/unwind/frontend.c4
-rw-r--r--sbin/unwind/unwind.c6
-rw-r--r--sbin/vnconfig/vnconfig.c12
-rw-r--r--sbin/wsconsctl/display.c6
-rw-r--r--sbin/wsconsctl/keyboard.c38
-rw-r--r--sbin/wsconsctl/mouse.c16
-rw-r--r--sbin/wsconsctl/wsconsctl.c10
-rw-r--r--usr.sbin/acme-client/http.c10
-rw-r--r--usr.sbin/acme-client/util.c14
-rw-r--r--usr.sbin/amd/amd/amd.c8
-rw-r--r--usr.sbin/amd/amd/rpc_fwd.c14
-rw-r--r--usr.sbin/apm/apm.c4
-rw-r--r--usr.sbin/apmd/apmd.c17
-rw-r--r--usr.sbin/arp/arp.c8
-rw-r--r--usr.sbin/authpf/authpf.c20
-rw-r--r--usr.sbin/bgpd/pftable.c6
-rw-r--r--usr.sbin/config/exec_elf.c6
-rw-r--r--usr.sbin/cron/atrun.c8
-rw-r--r--usr.sbin/cron/crontab.c12
-rw-r--r--usr.sbin/cron/database.c10
-rw-r--r--usr.sbin/cron/do_command.c8
-rw-r--r--usr.sbin/cron/popen.c10
-rw-r--r--usr.sbin/dhcpd/pfutils.c8
-rw-r--r--usr.sbin/dhcpd/udpsock.c10
-rw-r--r--usr.sbin/dvmrpd/interface.c22
-rw-r--r--usr.sbin/dvmrpd/kmroute.c14
-rw-r--r--usr.sbin/edquota/edquota.c6
-rw-r--r--usr.sbin/eeprom/ophandlers.c20
-rw-r--r--usr.sbin/eeprom/optree.c14
-rw-r--r--usr.sbin/eigrpd/interface.c28
-rw-r--r--usr.sbin/fdformat/fdformat.c12
-rw-r--r--usr.sbin/ftp-proxy/ftp-proxy.c14
-rw-r--r--usr.sbin/hostapd/hostapd.c4
-rw-r--r--usr.sbin/hostapd/privsep.c6
-rw-r--r--usr.sbin/hostapd/roaming.c6
-rw-r--r--usr.sbin/hostctl/hostctl.c6
-rw-r--r--usr.sbin/httpd/parse.y4
-rw-r--r--usr.sbin/httpd/server.c6
-rw-r--r--usr.sbin/ifstated/ifstated.c6
-rw-r--r--usr.sbin/inetd/inetd.c36
-rw-r--r--usr.sbin/installboot/armv7_installboot.c4
-rw-r--r--usr.sbin/installboot/bootstrap.c6
-rw-r--r--usr.sbin/installboot/i386_installboot.c12
-rw-r--r--usr.sbin/installboot/i386_nlist.c6
-rw-r--r--usr.sbin/installboot/i386_softraid.c6
-rw-r--r--usr.sbin/installboot/installboot.c4
-rw-r--r--usr.sbin/installboot/sparc64_installboot.c6
-rw-r--r--usr.sbin/installboot/sparc64_softraid.c4
-rw-r--r--usr.sbin/kgmon/kgmon.c26
-rw-r--r--usr.sbin/kvm_mkdb/kvm_mkdb.c4
-rw-r--r--usr.sbin/kvm_mkdb/nlist.c4
-rw-r--r--usr.sbin/kvm_mkdb/testdb.c4
-rw-r--r--usr.sbin/ldapd/ldape.c4
-rw-r--r--usr.sbin/ldpd/interface.c10
-rw-r--r--usr.sbin/ldpd/kroute.c6
-rw-r--r--usr.sbin/ldpd/neighbor.c4
-rw-r--r--usr.sbin/ldpd/socket.c34
-rw-r--r--usr.sbin/lpd/lpd.c4
-rw-r--r--usr.sbin/lpd/parse.y4
-rw-r--r--usr.sbin/map-mbone/mapper.c10
-rw-r--r--usr.sbin/memconfig/memconfig.c12
-rw-r--r--usr.sbin/mksuncd/mksuncd.c8
-rw-r--r--usr.sbin/mkuboot/mkuboot.c6
-rw-r--r--usr.sbin/mrinfo/mrinfo.c8
-rw-r--r--usr.sbin/mrouted/cfparse.y2
-rw-r--r--usr.sbin/mrouted/config.c2
-rw-r--r--usr.sbin/mrouted/igmp.c4
-rw-r--r--usr.sbin/mrouted/kern.c30
-rw-r--r--usr.sbin/mrouted/main.c10
-rw-r--r--usr.sbin/mrouted/prune.c8
-rw-r--r--usr.sbin/mrouted/rsrr.c10
-rw-r--r--usr.sbin/mrouted/vif.c18
-rw-r--r--usr.sbin/mtrace/mtrace.c10
-rw-r--r--usr.sbin/mtree/compare.c4
-rw-r--r--usr.sbin/mtree/crc.c4
-rw-r--r--usr.sbin/mtree/create.c4
-rw-r--r--usr.sbin/ndp/ndp.c18
-rw-r--r--usr.sbin/npppctl/npppctl.c6
-rw-r--r--usr.sbin/ntpd/constraint.c6
-rw-r--r--usr.sbin/ntpd/ntpd.c4
-rw-r--r--usr.sbin/ocspcheck/http.c10
-rw-r--r--usr.sbin/ospf6d/interface.c14
-rw-r--r--usr.sbin/ospfd/interface.c14
-rw-r--r--usr.sbin/pcidump/pcidump.c6
-rw-r--r--usr.sbin/portmap/portmap.c18
-rw-r--r--usr.sbin/pppd/sys-bsd.c130
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c10
-rw-r--r--usr.sbin/rad/frontend.c10
-rw-r--r--usr.sbin/rad/rad.c14
-rw-r--r--usr.sbin/radiusd/radiusd.c10
-rw-r--r--usr.sbin/radiusd/radiusd_module.c6
-rw-r--r--usr.sbin/radiusd/radiusd_radius.c4
-rw-r--r--usr.sbin/rarpd/arptab.c8
-rw-r--r--usr.sbin/rarpd/rarpd.c16
-rw-r--r--usr.sbin/rbootd/bpf.c24
-rw-r--r--usr.sbin/rbootd/parseconf.c4
-rw-r--r--usr.sbin/rbootd/rbootd.c6
-rw-r--r--usr.sbin/rbootd/rmpproto.c8
-rw-r--r--usr.sbin/rdate/ntp.c10
-rw-r--r--usr.sbin/rdate/rfc868time.c8
-rw-r--r--usr.sbin/relayd/check_icmp.c4
-rw-r--r--usr.sbin/relayd/parse.y4
-rw-r--r--usr.sbin/relayd/relay.c6
-rw-r--r--usr.sbin/ripd/interface.c24
-rw-r--r--usr.sbin/rmt/rmt.c6
-rw-r--r--usr.sbin/route6d/route6d.c44
-rw-r--r--usr.sbin/rpc.lockd/lockd_lock.c10
-rw-r--r--usr.sbin/rpki-client/io.c6
-rw-r--r--usr.sbin/rpki-client/main.c6
-rw-r--r--usr.sbin/sasyncd/conf.y4
-rw-r--r--usr.sbin/sensorsd/sensorsd.c4
-rw-r--r--usr.sbin/smtpd/crypto.c6
-rw-r--r--usr.sbin/smtpd/mail.maildir.c10
-rw-r--r--usr.sbin/smtpd/mail.mboxfile.c4
-rw-r--r--usr.sbin/smtpd/mda.c4
-rw-r--r--usr.sbin/smtpd/mproc.c6
-rw-r--r--usr.sbin/smtpd/mta_session.c6
-rw-r--r--usr.sbin/smtpd/parse.y4
-rw-r--r--usr.sbin/smtpd/queue_fs.c4
-rw-r--r--usr.sbin/smtpd/smtp.c4
-rw-r--r--usr.sbin/smtpd/smtp_session.c4
-rw-r--r--usr.sbin/smtpd/smtpd.c28
-rw-r--r--usr.sbin/smtpd/table_db.c6
-rw-r--r--usr.sbin/smtpd/util.c6
-rw-r--r--usr.sbin/snmpd/mib.c14
-rw-r--r--usr.sbin/snmpd/pf.c10
-rw-r--r--usr.sbin/switchd/ofcconn.c6
-rw-r--r--usr.sbin/syslogd/evbuffer_tls.c4
-rw-r--r--usr.sbin/syslogd/privsep.c16
-rw-r--r--usr.sbin/syslogd/syslogd.c12
-rw-r--r--usr.sbin/syslogd/ttymsg.c6
-rw-r--r--usr.sbin/tcpdump/pfctl_osfp.c8
-rw-r--r--usr.sbin/tcpdump/privsep.c10
-rw-r--r--usr.sbin/tcpdump/privsep_pcap.c22
-rw-r--r--usr.sbin/tcpdump/tcpdump.c4
-rw-r--r--usr.sbin/tcpdump/util.c6
-rw-r--r--usr.sbin/tftpd/tftpd.c10
-rw-r--r--usr.sbin/traceroute/traceroute.c35
-rw-r--r--usr.sbin/traceroute/worker.c8
-rw-r--r--usr.sbin/user/user.c40
-rw-r--r--usr.sbin/vipw/vipw.c10
-rw-r--r--usr.sbin/vmd/priv.c24
-rw-r--r--usr.sbin/vmd/vm.c14
-rw-r--r--usr.sbin/vmd/vmd.c4
-rw-r--r--usr.sbin/vmd/vmm.c6
-rw-r--r--usr.sbin/wsfontload/wsfontload.c10
-rw-r--r--usr.sbin/wsmoused/mouse_protocols.c8
-rw-r--r--usr.sbin/ypbind/ypbind.c18
-rw-r--r--usr.sbin/ypldap/ldapclient.c4
326 files changed, 1763 insertions, 1763 deletions
diff --git a/distrib/special/more/more.c b/distrib/special/more/more.c
index b4eabd6ea8a..cd95e25eb0d 100644
--- a/distrib/special/more/more.c
+++ b/distrib/special/more/more.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: more.c,v 1.40 2019/01/25 00:19:25 millert Exp $ */
+/* $OpenBSD: more.c,v 1.41 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <millert@openbsd.org>
@@ -1322,7 +1322,7 @@ retry:
* Wait until we're in the foreground before we save the
* the terminal modes.
*/
- if ((tgrp = tcgetpgrp(STDOUT_FILENO)) < 0) {
+ if ((tgrp = tcgetpgrp(STDOUT_FILENO)) == -1) {
perror("tcgetpgrp");
exit(1);
}
@@ -1333,7 +1333,7 @@ retry:
if ((term = getenv("TERM")) == 0 || tgetent(buf, term) <= 0) {
dumb++; ul_opt = 0;
} else {
- if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) < 0) {
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == -1) {
Lpp = tgetnum("li");
Mcol = tgetnum("co");
} else {
diff --git a/games/atc/log.c b/games/atc/log.c
index 6ff6afc100c..88640f61eff 100644
--- a/games/atc/log.c
+++ b/games/atc/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.24 2017/01/20 00:50:16 krw Exp $ */
+/* $OpenBSD: log.c,v 1.25 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: log.c,v 1.3 1995/03/21 15:04:21 cgd Exp $ */
/*-
@@ -120,7 +120,7 @@ open_score_file(void)
old_mode = umask(0);
score_fd = open(scorefile, O_CREAT|O_RDWR, 0644);
- if (score_fd < 0)
+ if (score_fd == -1)
err(1, "open");
/*
* This is done to take advantage of stdio, while still
@@ -144,7 +144,7 @@ log_score(int list_em)
if (score_fp == NULL)
return (-1);
- if (flock(fileno(score_fp), LOCK_EX) < 0)
+ if (flock(fileno(score_fp), LOCK_EX) == -1)
err(1, "flock");
snprintf(scanstr, 50, "%%%zus %%%zus %%d %%d %%d", sizeof(score[0].name)-1,
sizeof(score[0].game)-1);
diff --git a/games/grdc/grdc.c b/games/grdc/grdc.c
index ea2d3408b92..64a3b1b2196 100644
--- a/games/grdc/grdc.c
+++ b/games/grdc/grdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grdc.c,v 1.30 2019/01/06 18:27:14 tedu Exp $ */
+/* $OpenBSD: grdc.c,v 1.31 2019/06/28 13:32:52 deraadt Exp $ */
/*
*
* Copyright 2002 Amos Shapir. Public domain.
@@ -293,7 +293,7 @@ getwinsize(int *wid, int *ht)
{
struct winsize size;
- if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) < 0) {
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == -1) {
*wid = 80; /* Default */
*ht = 24;
} else {
diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c
index 9ce8d916a81..4abe525065d 100644
--- a/games/hack/hack.bones.c
+++ b/games/hack/hack.bones.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.bones.c,v 1.10 2016/01/09 18:33:15 mestre Exp $ */
+/* $OpenBSD: hack.bones.c,v 1.11 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -131,7 +131,7 @@ savebones(void)
otmp->cursed = 1; /* flag as gotten from a ghost */
}
}
- if((fd = open(bones, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0) return;
+ if((fd = open(bones, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) == -1) return;
savelev(fd,dlevel);
(void) close(fd);
}
@@ -144,7 +144,7 @@ getbones(void)
if(rn2(3)) return(0); /* only once in three times do we find bones */
bones[6] = '0' + dlevel/10;
bones[7] = '0' + dlevel%10;
- if((fd = open(bones, O_RDONLY)) < 0) return(0);
+ if((fd = open(bones, O_RDONLY)) == -1) return(0);
if((ok = uptodate(fd)) != 0){
getlev(fd, 0, dlevel);
for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++)
@@ -154,7 +154,7 @@ getbones(void)
#ifdef WIZARD
if(!wizard) /* duvel!frans: don't remove bones while debugging */
#endif /* WiZARD */
- if(unlink(bones) < 0){
+ if(unlink(bones) == -1){
pline("Cannot unlink %s .", bones);
return(0);
}
diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c
index 435b653ddfe..12d4752d02f 100644
--- a/games/hack/hack.do.c
+++ b/games/hack/hack.do.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.do.c,v 1.10 2016/01/09 18:33:15 mestre Exp $ */
+/* $OpenBSD: hack.do.c,v 1.11 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -195,7 +195,7 @@ goto_level(int newlevel, boolean at_stairs)
glo(dlevel);
fd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK);
- if(fd < 0) {
+ if(fd == -1) {
/*
* This is not quite impossible: e.g., we may have
* exceeded our quota. If that is the case then we
@@ -232,7 +232,7 @@ goto_level(int newlevel, boolean at_stairs)
else {
extern int hackpid;
- if((fd = open(lock, O_RDONLY)) < 0) {
+ if((fd = open(lock, O_RDONLY)) == -1) {
pline("Cannot open %s .", lock);
pline("Probably someone removed it.");
done("tricked");
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
index 820efd724d5..51a066600db 100644
--- a/games/hack/hack.main.c
+++ b/games/hack/hack.main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.main.c,v 1.23 2019/04/05 09:02:27 bentley Exp $ */
+/* $OpenBSD: hack.main.c,v 1.24 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -533,7 +533,7 @@ chdirx(char *dir, boolean wr)
dir = HACKDIR;
#endif
- if(dir && chdir(dir) < 0) {
+ if(dir && chdir(dir) == -1) {
perror(dir);
error("Cannot chdir to %s.", dir);
}
@@ -548,12 +548,12 @@ chdirx(char *dir, boolean wr)
if(dir == NULL)
dir = ".";
- if((fd = open(RECORD, O_RDWR | O_CREAT, FMASK)) < 0) {
+ if((fd = open(RECORD, O_RDWR | O_CREAT, FMASK)) == -1) {
printf("Warning: cannot write %s/%s", dir, RECORD);
getret();
} else
(void) close(fd);
- if((fd = open(HLOCK, O_RDONLY | O_CREAT, FMASK)) < 0) {
+ if((fd = open(HLOCK, O_RDONLY | O_CREAT, FMASK)) == -1) {
printf("Warning: cannot read %s/%s", dir, HLOCK);
getret();
} else
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c
index 8dd8b3a0045..32b65ef85b5 100644
--- a/games/hack/hack.pager.c
+++ b/games/hack/hack.pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.pager.c,v 1.24 2016/03/15 19:56:20 mestre Exp $ */
+/* $OpenBSD: hack.pager.c,v 1.25 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -369,7 +369,7 @@ page_file(char *fnam, boolean silent)
int fd = open(fnam, O_RDONLY);
- if(fd < 0) {
+ if(fd == -1) {
if(!silent) pline("Cannot open %s.", fnam);
return(0);
}
diff --git a/games/hack/hack.save.c b/games/hack/hack.save.c
index 900196f9c5a..ef498f7caae 100644
--- a/games/hack/hack.save.c
+++ b/games/hack/hack.save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.save.c,v 1.13 2016/01/09 18:33:15 mestre Exp $ */
+/* $OpenBSD: hack.save.c,v 1.14 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -101,7 +101,7 @@ dosave0(int hu)
(void) signal(SIGHUP, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
- if((fd = open(SAVEF, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0) {
+ if((fd = open(SAVEF, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) == -1) {
if(!hu) pline("Cannot open save file. (Continue or Quit)");
(void) unlink(SAVEF); /* ab@unido */
return(0);
@@ -131,7 +131,7 @@ dosave0(int hu)
if(tmp == dlevel || !level_exists[tmp]) continue;
glo(tmp);
- if((ofd = open(lock, O_RDONLY)) < 0) {
+ if((ofd = open(lock, O_RDONLY)) == -1) {
if(!hu) pline("Error while saving: cannot read %s.", lock);
(void) close(fd);
(void) unlink(SAVEF);
@@ -193,7 +193,7 @@ dorecover(int fd)
break;
getlev(fd, 0, tmp);
glo(tmp);
- if((nfd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) < 0)
+ if((nfd = open(lock, O_CREAT | O_TRUNC | O_WRONLY, FMASK)) == -1)
panic("Cannot open temp file %s!\n", lock);
savelev(nfd,tmp);
(void) close(nfd);
diff --git a/games/hack/hack.tty.c b/games/hack/hack.tty.c
index 321e978ce40..fb0251eb9aa 100644
--- a/games/hack/hack.tty.c
+++ b/games/hack/hack.tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.tty.c,v 1.15 2016/01/09 18:33:15 mestre Exp $ */
+/* $OpenBSD: hack.tty.c,v 1.16 2019/06/28 13:32:52 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -114,7 +114,7 @@ static void setctty(void);
void
gettty(void)
{
- if(tcgetattr(0, &inittyb) < 0)
+ if(tcgetattr(0, &inittyb) == -1)
perror("Hack (gettty)");
curttyb = inittyb;
erase_char = inittyb.c_cc[VERASE];
@@ -137,7 +137,7 @@ settty(char *s)
end_screen();
if(s) printf("%s", s);
(void) fflush(stdout);
- if(tcsetattr(0, TCSADRAIN, &inittyb) < 0)
+ if(tcsetattr(0, TCSADRAIN, &inittyb) == -1)
perror("Hack (settty)");
flags.echo = (inittyb.c_lflag & ECHO) ? ON : OFF;
flags.cbreak = (inittyb.c_lflag & ICANON) ? OFF : ON;
@@ -147,7 +147,7 @@ settty(char *s)
static void
setctty(void)
{
- if(tcsetattr(0, TCSADRAIN, &curttyb) < 0)
+ if(tcsetattr(0, TCSADRAIN, &curttyb) == -1)
perror("Hack (setctty)");
}
diff --git a/games/hack/makedefs.c b/games/hack/makedefs.c
index 5a30abe73c9..d8d9bc024df 100644
--- a/games/hack/makedefs.c
+++ b/games/hack/makedefs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makedefs.c,v 1.11 2018/08/24 11:14:49 mestre Exp $ */
+/* $OpenBSD: makedefs.c,v 1.12 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -93,7 +93,7 @@ main(int argc, char **argv)
(void)fprintf(stderr, "usage: makedefs file\n");
return 1;
}
- if ((fd = open(argv[1], O_RDONLY)) < 0) {
+ if ((fd = open(argv[1], O_RDONLY)) == -1) {
perror(argv[1]);
return 1;
}
@@ -138,7 +138,7 @@ readline(void)
{
int n = read(fd, lp0, (line+LINSZ)-lp0);
- if(n < 0){
+ if(n == -1){
printf("Input error.\n");
exit(1);
}
diff --git a/games/hangman/ksyms.c b/games/hangman/ksyms.c
index bb6866ffb55..12dea84e06f 100644
--- a/games/hangman/ksyms.c
+++ b/games/hangman/ksyms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ksyms.c,v 1.11 2017/10/27 16:47:08 mpi Exp $ */
+/* $OpenBSD: ksyms.c,v 1.12 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -44,7 +44,7 @@ sym_getword(void)
if (lseek(symfd, pos + symoffs, SEEK_SET) == -1)
continue;
buflen = read(symfd, symbuf, BUFSIZ);
- if (buflen < 0)
+ if (buflen == -1)
continue;
/*
@@ -94,7 +94,7 @@ sym_getword(void)
int
sym_setup(void)
{
- if ((symfd = open(Dict_name, O_RDONLY)) < 0)
+ if ((symfd = open(Dict_name, O_RDONLY)) == -1)
return -1;
if (ksyms_elf_parse() == 0)
diff --git a/games/hunt/hunt/list.c b/games/hunt/hunt/list.c
index d4a02c5ab1f..06a4e7c0ac6 100644
--- a/games/hunt/hunt/list.c
+++ b/games/hunt/hunt/list.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: list.c,v 1.9 2016/08/27 02:06:40 guenther Exp $ */
+/* $OpenBSD: list.c,v 1.10 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright 2001, David Leonard. All rights reserved.
* Redistribution and use in source and binary forms with or without
@@ -261,7 +261,7 @@ probe_drivers(u_int16_t req, char *preferred)
if ((ninbuf = realloc(inbuf, inlen)) == NULL)
err(1, "malloc");
ifc.ifc_buf = inbuf = ninbuf;
- if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0)
+ if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) == -1)
err(1, "SIOCGIFCONF");
if (ifc.ifc_len + sizeof(*ifr) < inlen)
break;
@@ -279,20 +279,20 @@ probe_drivers(u_int16_t req, char *preferred)
if (ifr->ifr_addr.sa_family != AF_INET)
continue;
- if (ioctl(fd, SIOCGIFFLAGS, (caddr_t)ifr) < 0) {
+ if (ioctl(fd, SIOCGIFFLAGS, (caddr_t)ifr) == -1) {
warn("%s: SIOCGIFFLAGS", ifr->ifr_name);
continue;
}
if ((ifr->ifr_flags & IFF_UP) == 0)
continue;
if ((ifr->ifr_flags & IFF_BROADCAST) != 0) {
- if (ioctl(fd, SIOCGIFBRDADDR, (caddr_t)ifr) < 0) {
+ if (ioctl(fd, SIOCGIFBRDADDR, (caddr_t)ifr) == -1) {
warn("%s: SIOCGIFBRDADDR", ifr->ifr_name);
continue;
}
target = (struct sockaddr_in *)&ifr->ifr_dstaddr;
} else if ((ifr->ifr_flags & IFF_POINTOPOINT) != 0) {
- if (ioctl(fd, SIOCGIFDSTADDR, (caddr_t)ifr) < 0) {
+ if (ioctl(fd, SIOCGIFDSTADDR, (caddr_t)ifr) == -1) {
warn("%s: SIOCGIFDSTADDR", ifr->ifr_name);
continue;
}
diff --git a/games/mille/save.c b/games/mille/save.c
index 2d620fa4e1a..71140d4a6ae 100644
--- a/games/mille/save.c
+++ b/games/mille/save.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: save.c,v 1.13 2016/09/11 14:21:18 tb Exp $ */
+/* $OpenBSD: save.c,v 1.14 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: save.c,v 1.4 1995/03/24 05:02:13 cgd Exp $ */
/*
@@ -108,7 +108,7 @@ over:
&& getyn(OVERWRITEFILEPROMPT) == FALSE))
return FALSE;
- if ((outf = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0644)) < 0) {
+ if ((outf = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1) {
error(strerror(errno));
return FALSE;
}
@@ -144,9 +144,9 @@ rest_f(const char *file)
char buf[80];
STAT sbuf;
- if ((inf = open(file, O_RDONLY)) < 0)
+ if ((inf = open(file, O_RDONLY)) == -1)
err(1, "%s", file);
- if (fstat(inf, &sbuf) < 0) /* get file stats */
+ if (fstat(inf, &sbuf) == -1) /* get file stats */
err(1, "%s", file);
varpush(inf, readv);
close(inf);
diff --git a/games/mille/varpush.c b/games/mille/varpush.c
index 6d3745d19a9..1d828b97ed7 100644
--- a/games/mille/varpush.c
+++ b/games/mille/varpush.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: varpush.c,v 1.11 2016/01/08 18:09:59 mestre Exp $ */
+/* $OpenBSD: varpush.c,v 1.12 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: varpush.c,v 1.4 1995/03/24 05:02:35 cgd Exp $ */
/*
@@ -73,7 +73,7 @@ varpush(int file, ssize_t (*func)(int, const struct iovec *, int))
}
if (func == readv) {
- if ((read(file, (void *) &temp, sizeof temp)) < 0) {
+ if ((read(file, (void *) &temp, sizeof temp)) == -1) {
error(strerror(errno));
return FALSE;
}
@@ -94,7 +94,7 @@ over:
#endif
} else {
temp = Topcard - Deck;
- if ((write(file, (void *) &temp, sizeof temp)) < 0) {
+ if ((write(file, (void *) &temp, sizeof temp)) == -1) {
error(strerror(errno));
return FALSE;
}
diff --git a/games/monop/execute.c b/games/monop/execute.c
index 4bea091af72..e8804e1a23d 100644
--- a/games/monop/execute.c
+++ b/games/monop/execute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: execute.c,v 1.14 2016/09/11 14:21:18 tb Exp $ */
+/* $OpenBSD: execute.c,v 1.15 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: execute.c,v 1.3 1995/03/23 08:34:38 cgd Exp $ */
/*
@@ -292,7 +292,7 @@ rest_f(char *file)
long tl;
printf("\"%s\" ", file);
- if (stat(file, &sbuf) < 0) { /* get file stats */
+ if (stat(file, &sbuf) == -1) { /* get file stats */
warn("%s", file);
return(FALSE);
}
diff --git a/games/phantasia/setup.c b/games/phantasia/setup.c
index 24ff234f8ca..4193afece68 100644
--- a/games/phantasia/setup.c
+++ b/games/phantasia/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.19 2016/03/07 12:07:56 mestre Exp $ */
+/* $OpenBSD: setup.c,v 1.20 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.4 1995/04/24 12:24:41 cgd Exp $ */
/*
@@ -116,11 +116,11 @@ main(int argc, char *argv[])
continue;
}
- if (unlink(path) < 0)
+ if (unlink(path) == -1)
Error("Cannot unlink %s.\n", path);
}
- if ((fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0660)) < 0)
+ if ((fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0660)) == -1)
Error("Cannot create %s.\n", path);
close(fd); /* close newly created file */
diff --git a/games/robots/main.c b/games/robots/main.c
index e7918dfa63d..be6ef3151b7 100644
--- a/games/robots/main.c
+++ b/games/robots/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.27 2018/08/23 06:26:35 mestre Exp $ */
+/* $OpenBSD: main.c,v 1.28 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: main.c,v 1.5 1995/04/22 10:08:54 cgd Exp $ */
/*
@@ -74,7 +74,7 @@ main(int ac, char *av[])
if (ret < 0 || ret >= PATH_MAX)
errc(1, ENAMETOOLONG, "%s/%s", home, ".robots.scores");
- if ((score_wfd = open(Scorefile, O_RDWR | O_CREAT, 0666)) < 0)
+ if ((score_wfd = open(Scorefile, O_RDWR | O_CREAT, 0666)) == -1)
score_err = errno;
show_only = FALSE;
@@ -113,7 +113,7 @@ main(int ac, char *av[])
if (score_wfd >= 0)
close(score_wfd);
/* This file requires no special privileges. */
- if ((score_wfd = open(Scorefile, O_RDWR | O_CREAT, 0666)) < 0)
+ if ((score_wfd = open(Scorefile, O_RDWR | O_CREAT, 0666)) == -1)
score_err = errno;
#ifdef FANCY
sp = strrchr(Scorefile, '/');
diff --git a/games/robots/score.c b/games/robots/score.c
index 029c725ba18..c5d81177509 100644
--- a/games/robots/score.c
+++ b/games/robots/score.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: score.c,v 1.15 2017/05/28 20:34:33 tedu Exp $ */
+/* $OpenBSD: score.c,v 1.16 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: score.c,v 1.3 1995/04/22 10:09:12 cgd Exp $ */
/*
@@ -168,7 +168,7 @@ show_score(void)
int inf;
static int max_score;
- if ((inf = open(Scorefile, O_RDONLY)) < 0) {
+ if ((inf = open(Scorefile, O_RDONLY)) == -1) {
perror(Scorefile);
return;
}
diff --git a/games/sail/misc.c b/games/sail/misc.c
index ebb18ecc7f0..958cbac6548 100644
--- a/games/sail/misc.c
+++ b/games/sail/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.10 2016/03/16 15:00:35 mestre Exp $ */
+/* $OpenBSD: misc.c,v 1.11 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: misc.c,v 1.3 1995/04/22 10:37:03 cgd Exp $ */
/*
@@ -203,7 +203,7 @@ logger(struct ship *s)
}
setegid(gid);
#ifdef LOCK_EX
- if (flock(fileno(fp), LOCK_EX) < 0)
+ if (flock(fileno(fp), LOCK_EX) == -1)
return;
#endif
net = (float)s->file->points / s->specs->pts;
diff --git a/games/sail/pl_1.c b/games/sail/pl_1.c
index 35d9dc5058c..e17e403d095 100644
--- a/games/sail/pl_1.c
+++ b/games/sail/pl_1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pl_1.c,v 1.12 2016/01/08 20:26:33 mestre Exp $ */
+/* $OpenBSD: pl_1.c,v 1.13 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: pl_1.c,v 1.3 1995/04/22 10:37:07 cgd Exp $ */
/*
@@ -131,7 +131,7 @@ child(int n __attribute__((unused)))
(void) signal(SIGCHLD, SIG_DFL);
do {
pid = waitpid((pid_t)-1, &status, WNOHANG);
- if (pid < 0 || (pid > 0 && !WIFSTOPPED(status)))
+ if (pid == -1 || (pid > 0 && !WIFSTOPPED(status)))
hasdriver = 0;
} while (pid > 0);
(void) signal(SIGCHLD, child);
diff --git a/games/sail/sync.c b/games/sail/sync.c
index 547b7121747..c7ecd5c85ad 100644
--- a/games/sail/sync.c
+++ b/games/sail/sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sync.c,v 1.15 2016/09/11 14:21:18 tb Exp $ */
+/* $OpenBSD: sync.c,v 1.16 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: sync.c,v 1.9 1998/08/30 09:19:40 veego Exp $ */
/*
@@ -119,7 +119,7 @@ sync_exists(int game)
(void) snprintf(buf, sizeof buf, SF, game);
(void) time(&t);
setegid(egid);
- if (stat(buf, &s) < 0) {
+ if (stat(buf, &s) == -1) {
setegid(gid);
return 0;
}
@@ -144,7 +144,7 @@ sync_open(void)
(void) snprintf(sync_lock, sizeof sync_lock, LF, game);
(void) snprintf(sync_file, sizeof sync_file, SF, game);
setegid(egid);
- if (stat(sync_file, &tmp) < 0) {
+ if (stat(sync_file, &tmp) == -1) {
mode_t omask = umask(002);
sync_fp = fopen(sync_file, "w+");
(void) umask(omask);
diff --git a/games/snake/snake.c b/games/snake/snake.c
index b7a115fb645..b33e85e1173 100644
--- a/games/snake/snake.c
+++ b/games/snake/snake.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snake.c,v 1.33 2019/01/20 04:14:19 tedu Exp $ */
+/* $OpenBSD: snake.c,v 1.34 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: snake.c,v 1.8 1995/04/29 00:06:41 mycroft Exp $ */
/*
@@ -971,7 +971,7 @@ readscores(int create)
errc(1, ENAMETOOLONG, "%s/%s", home, ".snake.scores");
rawscores = open(scorepath, modint, 0666);
- if (rawscores < 0) {
+ if (rawscores == -1) {
if (create == 0)
return 0;
err(1, "cannot open %s", scorepath);
diff --git a/games/tetris/scores.c b/games/tetris/scores.c
index e52ca152ac8..3b4b791625e 100644
--- a/games/tetris/scores.c
+++ b/games/tetris/scores.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scores.c,v 1.24 2019/05/20 02:11:22 lteo Exp $ */
+/* $OpenBSD: scores.c,v 1.25 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: scores.c,v 1.2 1995/04/22 07:42:38 cgd Exp $ */
/*-
@@ -107,7 +107,7 @@ getscores(FILE **fpp)
}
sd = open(scorepath, mint, 0666);
- if (sd < 0) {
+ if (sd == -1) {
if (fpp == NULL) {
nscores = 0;
return;
diff --git a/games/tetris/screen.c b/games/tetris/screen.c
index 4c5fb73fa4e..e407c3bf3fe 100644
--- a/games/tetris/screen.c
+++ b/games/tetris/screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen.c,v 1.18 2017/04/16 18:04:02 tb Exp $ */
+/* $OpenBSD: screen.c,v 1.19 2019/06/28 13:32:52 deraadt Exp $ */
/* $NetBSD: screen.c,v 1.4 1995/04/29 01:11:36 mycroft Exp $ */
/*-
@@ -279,12 +279,12 @@ scr_set(void)
MINROWS, MINCOLS);
stop(smallscr);
}
- if (tcgetattr(0, &oldtt) < 0)
+ if (tcgetattr(0, &oldtt) == -1)
stop("tcgetattr() fails");
newtt = oldtt;
newtt.c_lflag &= ~(ICANON|ECHO);
newtt.c_oflag &= ~OXTABS;
- if (tcsetattr(0, TCSADRAIN, &newtt) < 0)
+ if (tcsetattr(0, TCSADRAIN, &newtt) == -1)
stop("tcsetattr() fails");
(void) sigprocmask(SIG_BLOCK, &sigset, &osigset);
diff --git a/lib/libc/gen/alarm.c b/lib/libc/gen/alarm.c
index 8bca23a971f..f15dd151219 100644
--- a/lib/libc/gen/alarm.c
+++ b/lib/libc/gen/alarm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alarm.c,v 1.8 2016/01/28 16:40:54 schwarze Exp $ */
+/* $OpenBSD: alarm.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,7 +40,7 @@ alarm(unsigned int secs)
timerclear(&itp->it_interval);
itp->it_value.tv_sec = secs;
itp->it_value.tv_usec = 0;
- if (setitimer(ITIMER_REAL, itp, &oitv) < 0)
+ if (setitimer(ITIMER_REAL, itp, &oitv) == -1)
return ((unsigned int) -1);
if (oitv.it_value.tv_usec)
oitv.it_value.tv_sec++;
diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c
index a1a2e5a7b69..6d1844f4a28 100644
--- a/lib/libc/gen/auth_subr.c
+++ b/lib/libc/gen/auth_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth_subr.c,v 1.52 2019/03/23 17:03:00 millert Exp $ */
+/* $OpenBSD: auth_subr.c,v 1.53 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 2000-2002,2004 Todd C. Miller <millert@openbsd.org>
@@ -848,7 +848,7 @@ auth_call(auth_session_t *as, char *path, ...)
argv[argc] = NULL;
- if (socketpair(PF_LOCAL, SOCK_STREAM, 0, pfd) < 0) {
+ if (socketpair(PF_LOCAL, SOCK_STREAM, 0, pfd) == -1) {
syslog(LOG_ERR, "unable to create backchannel %m");
warnx("internal resource failure");
goto fail;
@@ -864,10 +864,10 @@ auth_call(auth_session_t *as, char *path, ...)
case 0:
#define COMM_FD 3
#define AUTH_FD 4
- if (dup2(pfd[1], COMM_FD) < 0)
+ if (dup2(pfd[1], COMM_FD) == -1)
err(1, "dup of backchannel");
if (as->fd != -1) {
- if (dup2(as->fd, AUTH_FD) < 0)
+ if (dup2(as->fd, AUTH_FD) == -1)
err(1, "dup of auth fd");
closefrom(AUTH_FD + 1);
} else
@@ -1003,7 +1003,7 @@ _recv_fd(auth_session_t *as, int fd)
memset(&msg, 0, sizeof(msg));
msg.msg_control = &cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
- if (recvmsg(fd, &msg, 0) < 0)
+ if (recvmsg(fd, &msg, 0) == -1)
syslog(LOG_ERR, "recvmsg: %m");
else if (msg.msg_flags & MSG_TRUNC)
syslog(LOG_ERR, "message truncated");
diff --git a/lib/libc/gen/authenticate.c b/lib/libc/gen/authenticate.c
index f1373694d58..fb96881832f 100644
--- a/lib/libc/gen/authenticate.c
+++ b/lib/libc/gen/authenticate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authenticate.c,v 1.26 2016/05/26 15:51:37 millert Exp $ */
+/* $OpenBSD: authenticate.c,v 1.27 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -164,7 +164,7 @@ auth_cat(char *file)
int fd, nchars;
char tbuf[8192];
- if ((fd = open(file, O_RDONLY, 0)) < 0)
+ if ((fd = open(file, O_RDONLY, 0)) == -1)
return (0);
while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0)
(void)write(fileno(stdout), tbuf, nchars);
@@ -282,7 +282,7 @@ auth_approval(auth_session_t *as, login_cap_t *lc, char *name, char *type)
pwd->pw_dir[0]) {
struct stat sb;
- if (stat(pwd->pw_dir, &sb) < 0 || !S_ISDIR(sb.st_mode) ||
+ if (stat(pwd->pw_dir, &sb) == -1 || !S_ISDIR(sb.st_mode) ||
(pwd->pw_uid && sb.st_uid == pwd->pw_uid &&
(sb.st_mode & S_IXUSR) == 0)) {
auth_setstate(as, (auth_getstate(as) & ~AUTH_ALLOW));
diff --git a/lib/libc/gen/ftok.c b/lib/libc/gen/ftok.c
index 387b80f3450..ea1edf1afd9 100644
--- a/lib/libc/gen/ftok.c
+++ b/lib/libc/gen/ftok.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftok.c,v 1.8 2014/11/15 22:38:47 guenther Exp $ */
+/* $OpenBSD: ftok.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
* All rights reserved.
@@ -34,7 +34,7 @@ ftok(const char *path, int id)
{
struct stat st;
- if (stat(path, &st) < 0)
+ if (stat(path, &st) == -1)
return (key_t)-1;
return (key_t)
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 98b3a0a390d..d13d0a3f223 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.58 2017/03/17 15:14:40 deraadt Exp $ */
+/* $OpenBSD: fts.c,v 1.59 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -160,7 +160,7 @@ fts_open(char * const *argv, int options,
* descriptor we run anyway, just more slowly.
*/
if (!ISSET(FTS_NOCHDIR) &&
- (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
+ (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) == -1)
SET(FTS_NOCHDIR);
if (nitems == 0)
@@ -287,7 +287,7 @@ fts_read(FTS *sp)
p->fts_info = fts_stat(sp, p, 1, -1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd =
- open(".", O_RDONLY | O_CLOEXEC)) < 0) {
+ open(".", O_RDONLY | O_CLOEXEC)) == -1) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@@ -377,7 +377,7 @@ next: tmp = p;
p->fts_info = fts_stat(sp, p, 1, -1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
if ((p->fts_symfd =
- open(".", O_RDONLY | O_CLOEXEC)) < 0) {
+ open(".", O_RDONLY | O_CLOEXEC)) == -1) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@@ -517,7 +517,7 @@ fts_children(FTS *sp, int instr)
ISSET(FTS_NOCHDIR))
return (sp->fts_child = fts_build(sp, instr));
- if ((fd = open(".", O_RDONLY | O_CLOEXEC)) < 0)
+ if ((fd = open(".", O_RDONLY | O_CLOEXEC)) == -1)
return (NULL);
sp->fts_child = fts_build(sp, instr);
if (fchdir(fd)) {
@@ -1028,9 +1028,9 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
newfd = fd;
if (ISSET(FTS_NOCHDIR))
return (0);
- if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0)
+ if (fd == -1 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) == -1)
return (-1);
- if (fstat(newfd, &sb)) {
+ if (fstat(newfd, &sb) == -1) {
ret = -1;
goto bail;
}
@@ -1042,7 +1042,7 @@ fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
ret = fchdir(newfd);
bail:
oerrno = errno;
- if (fd < 0)
+ if (fd == -1)
(void)close(newfd);
errno = oerrno;
return (ret);
diff --git a/lib/libc/gen/getloadavg.c b/lib/libc/gen/getloadavg.c
index 3ab72b09b47..f6e6b282222 100644
--- a/lib/libc/gen/getloadavg.c
+++ b/lib/libc/gen/getloadavg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getloadavg.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */
+/* $OpenBSD: getloadavg.c,v 1.8 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -52,7 +52,7 @@ getloadavg(double loadavg[], int nelem)
mib[0] = CTL_VM;
mib[1] = VM_LOADAVG;
size = sizeof(loadinfo);
- if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) < 0)
+ if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) == -1)
return (-1);
nelem = MINIMUM(nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t));
diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c
index 4ba27ce14a3..f12f8d86c09 100644
--- a/lib/libc/gen/getmntinfo.c
+++ b/lib/libc/gen/getmntinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getmntinfo.c,v 1.10 2015/09/14 16:09:13 tedu Exp $ */
+/* $OpenBSD: getmntinfo.c,v 1.11 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -42,18 +42,18 @@ getmntinfo(struct statfs **mntbufp, int flags)
static int mntsize;
static size_t bufsize;
- if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) < 0)
+ if (mntsize <= 0 && (mntsize = getfsstat(0, 0, MNT_NOWAIT)) == -1)
return (0);
- if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
+ if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) == -1)
return (0);
while (bufsize <= mntsize * sizeof(struct statfs)) {
free(mntbuf);
bufsize = (mntsize + 1) * sizeof(struct statfs);
- if ((mntbuf = malloc(bufsize)) == 0) {
+ if ((mntbuf = malloc(bufsize)) == NULL) {
bufsize = 0;
return (0);
}
- if ((mntsize = getfsstat(mntbuf, bufsize, flags)) < 0)
+ if ((mntsize = getfsstat(mntbuf, bufsize, flags)) == -1)
return (0);
}
*mntbufp = mntbuf;
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c
index b8c32ad653e..8f60409dcfd 100644
--- a/lib/libc/gen/initgroups.c
+++ b/lib/libc/gen/initgroups.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: initgroups.c,v 1.10 2015/09/12 14:56:50 guenther Exp $ */
+/* $OpenBSD: initgroups.c,v 1.11 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -41,7 +41,7 @@ initgroups(const char *uname, gid_t agroup)
ngroups = NGROUPS_MAX;
(void) getgrouplist(uname, agroup, groups, &ngroups);
- if (setgroups(ngroups, groups) < 0)
+ if (setgroups(ngroups, groups) == -1)
return (-1);
return (0);
}
diff --git a/lib/libc/gen/login_cap.c b/lib/libc/gen/login_cap.c
index 59652f006a0..b33c65c4291 100644
--- a/lib/libc/gen/login_cap.c
+++ b/lib/libc/gen/login_cap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_cap.c,v 1.36 2019/03/23 17:03:00 millert Exp $ */
+/* $OpenBSD: login_cap.c,v 1.37 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 2000-2004 Todd C. Miller <millert@openbsd.org>
@@ -598,7 +598,7 @@ setusercontext(login_cap_t *lc, struct passwd *pwd, uid_t uid, u_int flags)
if (flags & LOGIN_SETPRIORITY) {
p = login_getcapnum(lc, "priority", 0, 0);
- if (setpriority(PRIO_PROCESS, 0, (int)p) < 0)
+ if (setpriority(PRIO_PROCESS, 0, (int)p) == -1)
syslog(LOG_ERR, "%s: setpriority: %m", lc->lc_class);
}
@@ -608,14 +608,14 @@ setusercontext(login_cap_t *lc, struct passwd *pwd, uid_t uid, u_int flags)
}
if (flags & LOGIN_SETGROUP) {
- if (setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) < 0) {
+ if (setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) == -1) {
syslog(LOG_ERR, "setresgid(%u,%u,%u): %m",
pwd->pw_gid, pwd->pw_gid, pwd->pw_gid);
login_close(flc);
return (-1);
}
- if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) {
+ if (initgroups(pwd->pw_name, pwd->pw_gid) == -1) {
syslog(LOG_ERR, "initgroups(%s,%u): %m",
pwd->pw_name, pwd->pw_gid);
login_close(flc);
@@ -624,7 +624,7 @@ setusercontext(login_cap_t *lc, struct passwd *pwd, uid_t uid, u_int flags)
}
if (flags & LOGIN_SETLOGIN)
- if (setlogin(pwd->pw_name) < 0) {
+ if (setlogin(pwd->pw_name) == -1) {
syslog(LOG_ERR, "setlogin(%s) failure: %m",
pwd->pw_name);
login_close(flc);
@@ -632,7 +632,7 @@ setusercontext(login_cap_t *lc, struct passwd *pwd, uid_t uid, u_int flags)
}
if (flags & LOGIN_SETUSER) {
- if (setresuid(uid, uid, uid) < 0) {
+ if (setresuid(uid, uid, uid) == -1) {
syslog(LOG_ERR, "setresuid(%u,%u,%u): %m",
uid, uid, uid);
login_close(flc);
@@ -968,7 +968,7 @@ secure_path(char *path)
* If not a regular file, or is owned/writeable by someone
* other than root, quit.
*/
- if (lstat(path, &sb) < 0) {
+ if (lstat(path, &sb) == -1) {
syslog(LOG_ERR, "cannot stat %s: %m", path);
return (-1);
} else if (!S_ISREG(sb.st_mode)) {
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index 9a65ea3a66a..da66558a1f6 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.70 2019/05/13 17:18:10 guenther Exp $ */
+/* $OpenBSD: nlist.c,v 1.71 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -102,7 +102,7 @@ __fdnlist(int fd, struct nlist *list)
/* Make sure obj is OK */
if (pread(fd, &ehdr, sizeof(Elf_Ehdr), 0) != sizeof(Elf_Ehdr) ||
- !__elf_is_okay__(&ehdr) || fstat(fd, &st) < 0)
+ !__elf_is_okay__(&ehdr) || fstat(fd, &st) == -1)
return (-1);
/* calculate section header table size */
@@ -293,7 +293,7 @@ nlist(const char *name, struct nlist *list)
int fd, n;
fd = open(name, O_RDONLY | O_CLOEXEC);
- if (fd < 0)
+ if (fd == -1)
return (-1);
n = __fdnlist(fd, list);
(void)close(fd);
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 0779f70cae6..92a352c07b5 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.21 2015/08/31 02:53:57 guenther Exp $ */
+/* $OpenBSD: popen.c,v 1.22 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -70,7 +70,7 @@ popen(const char *program, const char *type)
if ((cur = malloc(sizeof(struct pid))) == NULL)
return (NULL);
- if (pipe2(pdes, O_CLOEXEC) < 0) {
+ if (pipe2(pdes, O_CLOEXEC) == -1) {
free(cur);
return (NULL);
}
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index a2d55b49167..f863ebc1e6b 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: posix_spawn.c,v 1.9 2016/03/13 18:34:20 guenther Exp $ */
+/* $OpenBSD: posix_spawn.c,v 1.10 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
@@ -141,7 +141,7 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
case FAE_OPEN:
/* Perform an open(), make it use the right fd */
fd = open(fae->fae_path, fae->fae_oflag, fae->fae_mode);
- if (fd < 0)
+ if (fd == -1)
return (errno);
if (fd != fae->fae_fildes) {
if (dup2(fd, fae->fae_fildes) == -1)
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index c364bda6c4f..870dc0a39ad 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scandir.c,v 1.20 2015/08/20 21:49:29 deraadt Exp $ */
+/* $OpenBSD: scandir.c,v 1.21 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -70,7 +70,7 @@ scandir(const char *dirname, struct dirent ***namelist,
if ((dirp = opendir(dirname)) == NULL)
return (-1);
- if (fstat(dirp->dd_fd, &stb) < 0)
+ if (fstat(dirp->dd_fd, &stb) == -1)
goto fail;
/*
@@ -97,7 +97,7 @@ scandir(const char *dirname, struct dirent ***namelist,
if (nitems >= arraysz) {
struct dirent **nnames;
- if (fstat(dirp->dd_fd, &stb) < 0)
+ if (fstat(dirp->dd_fd, &stb) == -1)
goto fail;
arraysz *= 2;
diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c
index b6725a6d7b6..99e4b5296c5 100644
--- a/lib/libc/gen/siginterrupt.c
+++ b/lib/libc/gen/siginterrupt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: siginterrupt.c,v 1.8 2015/10/23 04:39:24 guenther Exp $ */
+/* $OpenBSD: siginterrupt.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -40,7 +40,7 @@ siginterrupt(int sig, int flag)
struct sigaction sa;
int ret;
- if ((ret = WRAP(sigaction)(sig, NULL, &sa)) < 0)
+ if ((ret = WRAP(sigaction)(sig, NULL, &sa)) == -1)
return (ret);
if (flag) {
sigaddset(&__sigintr, sig);
diff --git a/lib/libc/gen/signal.c b/lib/libc/gen/signal.c
index c948ef0e5e0..35c6b075f9f 100644
--- a/lib/libc/gen/signal.c
+++ b/lib/libc/gen/signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.c,v 1.10 2015/10/25 04:13:59 guenther Exp $ */
+/* $OpenBSD: signal.c,v 1.11 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1985, 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -47,7 +47,7 @@ signal(int s, sig_t a)
sa.sa_flags = 0;
if (!sigismember(&__sigintr, s))
sa.sa_flags |= SA_RESTART;
- if (WRAP(sigaction)(s, &sa, &osa) < 0)
+ if (WRAP(sigaction)(s, &sa, &osa) == -1)
return (SIG_ERR);
return (osa.sa_handler);
}
diff --git a/lib/libc/gen/time.c b/lib/libc/gen/time.c
index 6fcf1cde209..3bbd0d733d1 100644
--- a/lib/libc/gen/time.c
+++ b/lib/libc/gen/time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.c,v 1.7 2015/10/29 03:58:55 mmcc Exp $ */
+/* $OpenBSD: time.c,v 1.8 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -36,7 +36,7 @@ time(time_t *t)
{
struct timeval tt;
- if (gettimeofday(&tt, NULL) < 0)
+ if (gettimeofday(&tt, NULL) == -1)
return (-1);
if (t)
*t = (time_t)tt.tv_sec;
diff --git a/lib/libc/gen/times.c b/lib/libc/gen/times.c
index d5a7210ee77..02e4dd44b5c 100644
--- a/lib/libc/gen/times.c
+++ b/lib/libc/gen/times.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: times.c,v 1.8 2018/03/02 16:35:58 cheloha Exp $ */
+/* $OpenBSD: times.c,v 1.9 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -44,11 +44,11 @@ times(struct tms *tp)
struct rusage ru;
struct timespec ts;
- if (getrusage(RUSAGE_SELF, &ru) < 0)
+ if (getrusage(RUSAGE_SELF, &ru) == -1)
return ((clock_t)-1);
tp->tms_utime = CONVTCK(ru.ru_utime);
tp->tms_stime = CONVTCK(ru.ru_stime);
- if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
+ if (getrusage(RUSAGE_CHILDREN, &ru) == -1)
return ((clock_t)-1);
tp->tms_cutime = CONVTCK(ru.ru_utime);
tp->tms_cstime = CONVTCK(ru.ru_stime);
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index cbfd663e839..c17fcc52bd1 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gmon.c,v 1.30 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: gmon.c,v 1.31 2019/06/28 13:32:41 deraadt Exp $ */
/*-
* Copyright (c) 1983, 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -162,7 +162,7 @@ _mcleanup(void)
size = sizeof(clockinfo);
mib[0] = CTL_KERN;
mib[1] = KERN_CLOCKRATE;
- if (sysctl(mib, 2, &clockinfo, &size, NULL, 0) < 0) {
+ if (sysctl(mib, 2, &clockinfo, &size, NULL, 0) == -1) {
/*
* Best guess
*/
@@ -221,13 +221,13 @@ _mcleanup(void)
}
fd = open(proffile , O_CREAT|O_TRUNC|O_WRONLY, 0664);
- if (fd < 0) {
+ if (fd == -1) {
perror( proffile );
return;
}
#ifdef DEBUG
log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
- if (log < 0) {
+ if (log == -1) {
perror("mcount: gmon.log");
close(fd);
return;
diff --git a/lib/libc/hash/helper.c b/lib/libc/hash/helper.c
index 8fa692af091..f36d385e552 100644
--- a/lib/libc/hash/helper.c
+++ b/lib/libc/hash/helper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: helper.c,v 1.17 2017/10/23 14:33:07 millert Exp $ */
+/* $OpenBSD: helper.c,v 1.18 2019/06/28 13:32:41 deraadt Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@@ -67,7 +67,7 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len)
HASHInit(&ctx);
- if ((fd = open(filename, O_RDONLY)) < 0)
+ if ((fd = open(filename, O_RDONLY)) == -1)
return (NULL);
if (len == 0) {
if (fstat(fd, &sb) == -1) {
@@ -78,7 +78,7 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len)
}
len = sb.st_size;
}
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
+ if (off > 0 && lseek(fd, off, SEEK_SET) == -1) {
save_errno = errno;
close(fd);
errno = save_errno;
@@ -94,7 +94,7 @@ HASHFileChunk(const char *filename, char *buf, off_t off, off_t len)
save_errno = errno;
close(fd);
errno = save_errno;
- return (nr < 0 ? NULL : HASHEnd(&ctx, buf));
+ return (nr == -1 ? NULL : HASHEnd(&ctx, buf));
}
DEF_WEAK(HASHFileChunk);
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index d5c3e5c0681..97566656ec0 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rune.c,v 1.7 2016/09/05 09:47:03 schwarze Exp $ */
+/* $OpenBSD: rune.c,v 1.8 2019/06/28 13:32:41 deraadt Exp $ */
/* $NetBSD: rune.c,v 1.26 2004/05/09 11:26:33 kleink Exp $ */
/*-
@@ -227,7 +227,7 @@ _Read_RuneMagi(FILE *fp)
int x;
uint32_t runetype_nranges, maplower_nranges, mapupper_nranges, var_len;
- if (fstat(fileno(fp), &sb) < 0)
+ if (fstat(fileno(fp), &sb) == -1)
return NULL;
if (sb.st_size < sizeof(_FileRuneLocale))
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c
index b9cbd6d5d14..66caac3f3d9 100644
--- a/lib/libc/net/rcmdsh.c
+++ b/lib/libc/net/rcmdsh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcmdsh.c,v 1.19 2016/05/28 15:46:00 millert Exp $ */
+/* $OpenBSD: rcmdsh.c,v 1.20 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2001, MagniComp
@@ -89,13 +89,13 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser,
}
/* Get a socketpair we'll use for stdin and stdout. */
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) < 0) {
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) {
perror("rcmdsh: socketpair");
return(-1);
}
cpid = fork();
- if (cpid < 0) {
+ if (cpid == -1) {
perror("rcmdsh: fork failed");
return(-1);
} else if (cpid == 0) {
@@ -103,13 +103,13 @@ rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser,
* Child. We use sp[1] to be stdin/stdout, and close sp[0].
*/
(void) close(sp[0]);
- if (dup2(sp[1], 0) < 0 || dup2(0, 1) < 0) {
+ if (dup2(sp[1], 0) == -1 || dup2(0, 1) == -1) {
perror("rcmdsh: dup2 failed");
_exit(255);
}
/* Fork again to lose parent. */
cpid = fork();
- if (cpid < 0) {
+ if (cpid == -1) {
perror("rcmdsh: fork to lose parent failed");
_exit(255);
}
diff --git a/lib/libc/net/rresvport.c b/lib/libc/net/rresvport.c
index 6b45000f7b7..72c27c3a3f0 100644
--- a/lib/libc/net/rresvport.c
+++ b/lib/libc/net/rresvport.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rresvport.c,v 1.11 2015/09/12 14:56:50 guenther Exp $ */
+/* $OpenBSD: rresvport.c,v 1.12 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1998 Theo de Raadt. All rights reserved.
* Copyright (c) 1983, 1993, 1994
@@ -82,12 +82,12 @@ rresvport_af(int *alport, int af)
sa->sa_family = af;
s = socket(af, SOCK_STREAM, 0);
- if (s < 0)
+ if (s == -1)
return (-1);
*portp = htons(*alport);
if (*alport < IPPORT_RESERVED - 1) {
- if (bind(s, sa, sa->sa_len) >= 0)
+ if (bind(s, sa, sa->sa_len) != -1)
return (s);
if (errno != EADDRINUSE) {
(void)close(s);
diff --git a/lib/libc/net/ruserok.c b/lib/libc/net/ruserok.c
index cab6f964494..a399c013e26 100644
--- a/lib/libc/net/ruserok.c
+++ b/lib/libc/net/ruserok.c
@@ -131,11 +131,11 @@ again:
* user or root or if writeable by anyone but the owner, quit.
*/
cp = NULL;
- if (lstat(pbuf, &sbuf) < 0)
+ if (lstat(pbuf, &sbuf) == -1)
cp = ".rhosts lstat failed";
else if (!S_ISREG(sbuf.st_mode))
cp = ".rhosts not regular file";
- else if (fstat(fileno(hostf), &sbuf) < 0)
+ else if (fstat(fileno(hostf), &sbuf) == -1)
cp = ".rhosts fstat failed";
else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid)
cp = "bad .rhosts owner";
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c
index 1ee7f7a50cb..402d98cede4 100644
--- a/lib/libc/rpc/auth_unix.c
+++ b/lib/libc/rpc/auth_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth_unix.c,v 1.26 2015/11/01 03:45:29 guenther Exp $ */
+/* $OpenBSD: auth_unix.c,v 1.27 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -194,7 +194,7 @@ authunix_create_default(void)
machname[MAX_MACHINE_NAME] = 0;
uid = geteuid();
gid = getegid();
- if ((len = getgroups(NGRPS, gids)) < 0)
+ if ((len = getgroups(NGRPS, gids)) == -1)
return (NULL);
if (len > maxgrplist)
len = maxgrplist;
diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c
index 145a7de9944..536b1f2ab9b 100644
--- a/lib/libc/rpc/bindresvport.c
+++ b/lib/libc/rpc/bindresvport.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bindresvport.c,v 1.18 2015/09/14 11:01:47 guenther Exp $ */
+/* $OpenBSD: bindresvport.c,v 1.19 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright 1996, Jason Downs. All rights reserved.
@@ -92,12 +92,12 @@ bindresvport_sa(int sd, struct sockaddr *sa)
socklen_t oldlen = sizeof(old);
error = getsockopt(sd, proto, portrange, &old, &oldlen);
- if (error < 0)
+ if (error == -1)
return (error);
error = setsockopt(sd, proto, portrange, &portlow,
sizeof(portlow));
- if (error < 0)
+ if (error == -1)
return (error);
}
@@ -108,14 +108,14 @@ bindresvport_sa(int sd, struct sockaddr *sa)
if (error) {
if (setsockopt(sd, proto, portrange, &old,
- sizeof(old)) < 0)
+ sizeof(old)) == -1)
errno = saved_errno;
return (error);
}
if (sa != (struct sockaddr *)&myaddr) {
/* Hmm, what did the kernel assign... */
- if (getsockname(sd, sa, &salen) < 0)
+ if (getsockname(sd, sa, &salen) == -1)
errno = saved_errno;
return (error);
}
diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c
index c29d0f4c1d9..8e6ef515b0e 100644
--- a/lib/libc/rpc/clnt_tcp.c
+++ b/lib/libc/rpc/clnt_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clnt_tcp.c,v 1.32 2018/01/06 15:37:36 cheloha Exp $ */
+/* $OpenBSD: clnt_tcp.c,v 1.33 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -148,9 +148,9 @@ clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp,
if (*sockp < 0) {
*sockp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
(void)bindresvport(*sockp, NULL);
- if ((*sockp < 0)
+ if ((*sockp == -1)
|| (connect(*sockp, (struct sockaddr *)raddr,
- sizeof(*raddr)) < 0)) {
+ sizeof(*raddr)) == -1)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
if (*sockp != -1)
diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c
index fd0d83611c0..68d01674410 100644
--- a/lib/libc/rpc/clnt_udp.c
+++ b/lib/libc/rpc/clnt_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clnt_udp.c,v 1.35 2018/01/06 15:37:36 cheloha Exp $ */
+/* $OpenBSD: clnt_udp.c,v 1.36 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -158,7 +158,7 @@ clntudp_bufcreate(struct sockaddr_in *raddr, u_long program, u_long version,
if (*sockp < 0) {
*sockp = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK,
IPPROTO_UDP);
- if (*sockp < 0) {
+ if (*sockp == -1) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
goto fooy;
@@ -299,8 +299,8 @@ send_again:
inlen = recvfrom(cu->cu_sock, cu->cu_inbuf,
(int) cu->cu_recvsz, 0,
(struct sockaddr *)&from, &fromlen);
- } while (inlen < 0 && errno == EINTR);
- if (inlen < 0) {
+ } while (inlen == -1 && errno == EINTR);
+ if (inlen == -1) {
if (errno == EWOULDBLOCK)
continue;
cu->cu_error.re_errno = errno;
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 50237f324c2..097999b5ae6 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap_rmt.c,v 1.34 2015/12/28 22:08:18 mmcc Exp $ */
+/* $OpenBSD: pmap_rmt.c,v 1.35 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -238,12 +238,12 @@ clnt_broadcast(u_long prog, /* program number */
* initialization: create a socket, a broadcast address, and
* preserialize the arguments into a send buffer.
*/
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
stat = RPC_CANTSEND;
goto done_broad;
}
#ifdef SO_BROADCAST
- if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) == -1) {
stat = RPC_CANTSEND;
goto done_broad;
}
@@ -338,7 +338,7 @@ clnt_broadcast(u_long prog, /* program number */
fromlen = sizeof(struct sockaddr);
inlen = recvfrom(sock, inbuf, UDPMSGSIZE, 0,
(struct sockaddr *)&raddr, &fromlen);
- if (inlen < 0) {
+ if (inlen == -1) {
if (errno == EINTR)
goto try_again;
stat = RPC_CANTRECV;
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index 11d3961ee3a..f9d7a70938f 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_tcp.c,v 1.39 2017/12/14 18:56:22 jca Exp $ */
+/* $OpenBSD: svc_tcp.c,v 1.40 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -134,18 +134,18 @@ svctcp_create(int sock, u_int sendsize, u_int recvsize)
socklen_t len = sizeof(struct sockaddr_in);
if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+ if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
return (NULL);
madesock = TRUE;
}
memset(&addr, 0, sizeof (addr));
addr.sin_len = sizeof(struct sockaddr_in);
addr.sin_family = AF_INET;
- if (bindresvport(sock, &addr)) {
+ if (bindresvport(sock, &addr) == -1) {
addr.sin_port = 0;
(void)bind(sock, (struct sockaddr *)&addr, len);
}
- if ((getsockname(sock, (struct sockaddr *)&addr, &len) != 0) ||
+ if ((getsockname(sock, (struct sockaddr *)&addr, &len) == -1) ||
(listen(sock, 2) != 0)) {
if (madesock)
(void)close(sock);
@@ -241,7 +241,7 @@ rendezvous_request(SVCXPRT *xprt, struct rpc_msg *ignored)
again:
len = sizeof(struct sockaddr_in);
if ((sock = accept(xprt->xp_sock, (struct sockaddr *)&addr,
- &len)) < 0) {
+ &len)) == -1) {
if (errno == EINTR || errno == EWOULDBLOCK ||
errno == ECONNABORTED)
goto again;
@@ -254,8 +254,9 @@ rendezvous_request(SVCXPRT *xprt, struct rpc_msg *ignored)
socklen_t optsize = sizeof(opts);
int i;
- if (!getsockopt(sock, IPPROTO_IP, IP_OPTIONS, (char *)&opts,
- &optsize) && optsize != 0) {
+ if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS,
+ (char *)&opts, &optsize) == 0 &&
+ optsize != 0) {
for (i = 0; (char *)&opts.ipopt_list[i] - (char *)&opts <
optsize; ) {
u_char c = (u_char)opts.ipopt_list[i];
@@ -377,7 +378,7 @@ writetcp(SVCXPRT *xprt, caddr_t buf, int len)
int i, cnt;
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
- if ((i = write(xprt->xp_sock, buf, cnt)) < 0) {
+ if ((i = write(xprt->xp_sock, buf, cnt)) == -1) {
((struct tcp_conn *)(xprt->xp_p1))->strm_stat =
XPRT_DIED;
return (-1);
diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c
index da8d4d5af94..ccd00f3c4ab 100644
--- a/lib/libc/rpc/svc_udp.c
+++ b/lib/libc/rpc/svc_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_udp.c,v 1.25 2015/11/01 03:45:29 guenther Exp $ */
+/* $OpenBSD: svc_udp.c,v 1.26 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -104,7 +104,7 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz)
socklen_t len = sizeof(struct sockaddr_in);
if (sock == RPC_ANYSOCK) {
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
return (NULL);
madesock = TRUE;
}
diff --git a/lib/libc/rpc/xdr_stdio.c b/lib/libc/rpc/xdr_stdio.c
index db0ad4ba809..d010a8a4e53 100644
--- a/lib/libc/rpc/xdr_stdio.c
+++ b/lib/libc/rpc/xdr_stdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xdr_stdio.c,v 1.14 2015/11/01 03:45:29 guenther Exp $ */
+/* $OpenBSD: xdr_stdio.c,v 1.15 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -144,7 +144,7 @@ static bool_t
xdrstdio_setpos(XDR *xdrs, u_int pos)
{
- return ((fseek((FILE *)xdrs->x_private, (long)pos, SEEK_SET) < 0) ?
+ return ((fseek((FILE *)xdrs->x_private, (long)pos, SEEK_SET) == -1) ?
FALSE : TRUE);
}
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
index 8ba51eeab01..5ec625f739c 100644
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdopen.c,v 1.9 2016/03/20 00:01:21 krw Exp $ */
+/* $OpenBSD: fdopen.c,v 1.10 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -55,7 +55,7 @@ fdopen(int fd, const char *mode)
return (NULL);
/* Make sure the mode the user wants is a subset of the actual mode. */
- if ((fdflags = fcntl(fd, F_GETFL)) < 0)
+ if ((fdflags = fcntl(fd, F_GETFL)) == -1)
return (NULL);
tmp = fdflags & O_ACCMODE;
if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c
index 5932a552158..d62e2eb36d6 100644
--- a/lib/libc/stdio/fopen.c
+++ b/lib/libc/stdio/fopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fopen.c,v 1.9 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: fopen.c,v 1.10 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -51,7 +51,7 @@ fopen(const char *file, const char *mode)
return (NULL);
if ((fp = __sfp()) == NULL)
return (NULL);
- if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
+ if ((f = open(file, oflags, DEFFILEMODE)) == -1) {
fp->_flags = 0; /* release */
return (NULL);
}
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index f2e975df69e..1d0895a819a 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fseek.c,v 1.12 2015/08/31 02:53:57 guenther Exp $ */
+/* $OpenBSD: fseek.c,v 1.13 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -127,7 +127,7 @@ fseeko(FILE *fp, off_t offset, int whence)
goto dumb;
if ((fp->_flags & __SOPT) == 0) {
if (seekfn != __sseek ||
- fp->_file < 0 || fstat(fp->_file, &st) ||
+ fp->_file < 0 || fstat(fp->_file, &st) == -1 ||
(st.st_mode & S_IFMT) != S_IFREG) {
fp->_flags |= __SNPT;
goto dumb;
@@ -143,7 +143,7 @@ fseeko(FILE *fp, off_t offset, int whence)
if (whence == SEEK_SET)
target = offset;
else {
- if (fstat(fp->_file, &st))
+ if (fstat(fp->_file, &st) == -1)
goto dumb;
target = st.st_size + offset;
}
diff --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c
index 56e5f210cf4..b771a408779 100644
--- a/lib/libc/stdio/makebuf.c
+++ b/lib/libc/stdio/makebuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makebuf.c,v 1.9 2015/01/13 07:18:21 guenther Exp $ */
+/* $OpenBSD: makebuf.c,v 1.10 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -81,7 +81,7 @@ __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty)
{
struct stat st;
- if (fp->_file < 0 || fstat(fp->_file, &st) < 0) {
+ if (fp->_file < 0 || fstat(fp->_file, &st) == -1) {
*couldbetty = 0;
*bufsize = BUFSIZ;
return (__SNPT);
diff --git a/lib/libc/stdio/remove.c b/lib/libc/stdio/remove.c
index e08e5997658..f3ad006376b 100644
--- a/lib/libc/stdio/remove.c
+++ b/lib/libc/stdio/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.8 2015/08/31 02:53:57 guenther Exp $ */
+/* $OpenBSD: remove.c,v 1.9 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -41,7 +41,7 @@ remove(const char *file)
{
struct stat st;
- if (lstat(file, &st) < 0)
+ if (lstat(file, &st) == -1)
return (-1);
if (S_ISDIR(st.st_mode))
return (rmdir(file));
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index f2e82679e9d..7d49438b7be 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.261 2019/05/23 06:43:18 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.262 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -897,7 +897,7 @@ omalloc_make_chunks(struct dir_info *d, int bits, int listnum)
return NULL;
/* memory protect the page allocated in the malloc(0) case */
- if (bits == 0 && mprotect(pp, MALLOC_PAGESIZE, PROT_NONE) < 0)
+ if (bits == 0 && mprotect(pp, MALLOC_PAGESIZE, PROT_NONE) == -1)
goto err;
bp = alloc_chunk_info(d, bits);
diff --git a/lib/libc/termios/tcgetpgrp.c b/lib/libc/termios/tcgetpgrp.c
index a85267a9a6e..b8aedf98be0 100644
--- a/lib/libc/termios/tcgetpgrp.c
+++ b/lib/libc/termios/tcgetpgrp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcgetpgrp.c,v 1.7 2014/12/16 03:32:21 millert Exp $ */
+/* $OpenBSD: tcgetpgrp.c,v 1.8 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -36,7 +36,7 @@ tcgetpgrp(int fd)
{
int s;
- if (ioctl(fd, TIOCGPGRP, &s) < 0)
+ if (ioctl(fd, TIOCGPGRP, &s) == -1)
return (-1);
return (s);
diff --git a/lib/libc/termios/tcgetsid.c b/lib/libc/termios/tcgetsid.c
index 531179212ef..2f25a962bd3 100644
--- a/lib/libc/termios/tcgetsid.c
+++ b/lib/libc/termios/tcgetsid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcgetsid.c,v 1.3 2013/12/17 22:12:07 millert Exp $ */
+/* $OpenBSD: tcgetsid.c,v 1.4 2019/06/28 13:32:42 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -36,7 +36,7 @@ tcgetsid(int fd)
{
int s;
- if (ioctl(fd, TIOCGSID, &s) < 0)
+ if (ioctl(fd, TIOCGSID, &s) == -1)
return (-1);
return (s);
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index fbe33e94aef..2fb277dee22 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: localtime.c,v 1.60 2019/05/12 12:49:52 schwarze Exp $ */
+/* $OpenBSD: localtime.c,v 1.61 2019/06/28 13:32:42 deraadt Exp $ */
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -342,7 +342,7 @@ tzload(const char *name, struct state *sp, int doextend)
goto oops;
nread = read(fid, up->buf, sizeof up->buf);
- if (close(fid) < 0 || nread <= 0)
+ if (close(fid) == -1 || nread <= 0)
goto oops;
for (stored = 4; stored <= 8; stored *= 2) {
int ttisstdcnt;
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index af13ec54946..54a9dc553ad 100644
--- a/lib/libedit/readline.c
+++ b/lib/libedit/readline.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readline.c,v 1.27 2016/05/31 16:12:00 schwarze Exp $ */
+/* $OpenBSD: readline.c,v 1.28 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */
/*-
@@ -1265,7 +1265,7 @@ history_truncate_file (const char *filename, int nlines)
if (nlines <= 0 || count == 0)
break;
count--;
- if (fseeko(tp, (off_t)sizeof(buf) * count, SEEK_SET) < 0) {
+ if (fseeko(tp, (off_t)sizeof(buf) * count, SEEK_SET) == -1) {
ret = errno;
break;
}
@@ -2092,16 +2092,16 @@ _rl_event_read_char(EditLine *el, wchar_t *wc)
(*rl_event_hook)();
#if defined(FIONREAD)
- if (ioctl(el->el_infd, FIONREAD, &n) < 0)
+ if (ioctl(el->el_infd, FIONREAD, &n) == -1)
return -1;
if (n)
num_read = read(el->el_infd, &ch, 1);
else
num_read = 0;
#elif defined(F_SETFL) && defined(O_NDELAY)
- if ((n = fcntl(el->el_infd, F_GETFL)) < 0)
+ if ((n = fcntl(el->el_infd, F_GETFL)) == -1)
return -1;
- if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) < 0)
+ if (fcntl(el->el_infd, F_SETFL, n|O_NDELAY) == -1)
return -1;
num_read = read(el->el_infd, &ch, 1);
if (fcntl(el->el_infd, F_SETFL, n))
diff --git a/lib/libevent/evutil.c b/lib/libevent/evutil.c
index 1f66772d5f5..81add1dfc29 100644
--- a/lib/libevent/evutil.c
+++ b/lib/libevent/evutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evutil.c,v 1.10 2016/03/20 00:01:22 krw Exp $ */
+/* $OpenBSD: evutil.c,v 1.11 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2007 Niels Provos <provos@citi.umich.edu>
@@ -54,7 +54,7 @@ evutil_make_socket_nonblocking(int fd)
{
int flags;
- if ((flags = fcntl(fd, F_GETFL)) < 0) {
+ if ((flags = fcntl(fd, F_GETFL)) == -1) {
event_warn("fcntl(%d, F_GETFL)", fd);
return -1;
}
diff --git a/lib/libfuse/fuse.c b/lib/libfuse/fuse.c
index bc83a2812ae..2b8c0ebdfc6 100644
--- a/lib/libfuse/fuse.c
+++ b/lib/libfuse/fuse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse.c,v 1.50 2018/11/16 02:16:17 tedu Exp $ */
+/* $OpenBSD: fuse.c,v 1.51 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -121,7 +121,7 @@ ifuse_try_unmount(struct fuse *f)
/* unmount in another thread so fuse_loop() doesn't deadlock */
child = fork();
- if (child < 0) {
+ if (child == -1) {
DPERROR(__func__);
return;
}
@@ -218,7 +218,7 @@ fuse_loop(struct fuse *fuse)
ioexch.fbxch_data = fbuf.fb_dat;
if (ioctl(fuse->fc->fd, FIOCGETFBDAT,
- &ioexch)) {
+ &ioexch) == -1) {
free(fbuf.fb_dat);
return (-1);
}
@@ -249,7 +249,7 @@ fuse_loop(struct fuse *fuse)
ioexch.fbxch_len = fbuf.fb_len;
ioexch.fbxch_data = fbuf.fb_dat;
- if (ioctl(fuse->fc->fd, FIOCSETFBDAT, &ioexch)) {
+ if (ioctl(fuse->fc->fd, FIOCSETFBDAT, &ioexch) == -1) {
free(fbuf.fb_dat);
return (-1);
}
diff --git a/lib/libkeynote/keynote-sign.c b/lib/libkeynote/keynote-sign.c
index 6609a879b8a..29469215dcb 100644
--- a/lib/libkeynote/keynote-sign.c
+++ b/lib/libkeynote/keynote-sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sign.c,v 1.18 2015/11/19 07:00:58 guenther Exp $ */
+/* $OpenBSD: keynote-sign.c,v 1.19 2019/06/28 13:32:42 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -104,13 +104,13 @@ keynote_sign(int argc, char *argv[])
/* Read assertion */
fd = open(argv[2 + flg], O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
{
perror(argv[2 + flg]);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -130,7 +130,7 @@ keynote_sign(int argc, char *argv[])
exit(1);
}
- if (read(fd, buf, buflen - 1) < 0)
+ if (read(fd, buf, buflen - 1) == -1)
{
perror("read()");
exit(1);
@@ -140,13 +140,13 @@ keynote_sign(int argc, char *argv[])
/* Read private key file */
fd = open(argv[3 + flg], O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
{
perror(argv[3 + flg]);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -165,7 +165,7 @@ keynote_sign(int argc, char *argv[])
exit(1);
}
- if (read(fd, buf2, sb.st_size) < 0)
+ if (read(fd, buf2, sb.st_size) == -1)
{
perror("read()");
exit(1);
diff --git a/lib/libkeynote/keynote-sigver.c b/lib/libkeynote/keynote-sigver.c
index 61ebe036ed1..6c87e386349 100644
--- a/lib/libkeynote/keynote-sigver.c
+++ b/lib/libkeynote/keynote-sigver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-sigver.c,v 1.16 2015/11/19 02:35:24 mmcc Exp $ */
+/* $OpenBSD: keynote-sigver.c,v 1.17 2019/06/28 13:32:42 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -57,13 +57,13 @@ keynote_sigver(int argc, char *argv[])
/* Open and read assertion file */
fd = open(argv[1], O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
{
perror(argv[1]);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -82,7 +82,7 @@ keynote_sigver(int argc, char *argv[])
exit(1);
}
- if (read(fd, buf, sb.st_size) < 0)
+ if (read(fd, buf, sb.st_size) == -1)
{
perror("read()");
exit(1);
diff --git a/lib/libkeynote/keynote-verify.c b/lib/libkeynote/keynote-verify.c
index 1368c21dd00..d6f13f19295 100644
--- a/lib/libkeynote/keynote-verify.c
+++ b/lib/libkeynote/keynote-verify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keynote-verify.c,v 1.17 2015/11/19 05:20:19 mmcc Exp $ */
+/* $OpenBSD: keynote-verify.c,v 1.18 2019/06/28 13:32:42 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -102,13 +102,13 @@ keynote_verify(int argc, char *argv[])
case 'k':
sk = 1;
- if ((fd = open(optarg, O_RDONLY, 0)) < 0)
+ if ((fd = open(optarg, O_RDONLY, 0)) == -1)
{
perror(optarg);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -127,7 +127,7 @@ keynote_verify(int argc, char *argv[])
}
i = read(fd, buf, sb.st_size);
- if (i < 0)
+ if (i == -1)
{
perror("read()");
exit(1);
@@ -222,13 +222,13 @@ keynote_verify(int argc, char *argv[])
break;
case 'l':
- if ((fd = open(optarg, O_RDONLY, 0)) < 0)
+ if ((fd = open(optarg, O_RDONLY, 0)) == -1)
{
perror(optarg);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -247,7 +247,7 @@ keynote_verify(int argc, char *argv[])
}
i = read(fd, buf, sb.st_size);
- if (i < 0)
+ if (i == -1)
{
perror("read()");
exit(1);
@@ -306,13 +306,13 @@ keynote_verify(int argc, char *argv[])
while (argc--)
{
- if ((fd = open(argv[argc], O_RDONLY, 0)) < 0)
+ if ((fd = open(argv[argc], O_RDONLY, 0)) == -1)
{
perror(argv[argc]);
exit(1);
}
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
{
perror("fstat()");
exit(1);
@@ -331,7 +331,7 @@ keynote_verify(int argc, char *argv[])
}
i = read(fd, buf, sb.st_size);
- if (i < 0)
+ if (i == -1)
{
perror("read()");
exit(1);
diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c
index f1d14a04cc2..610173686e3 100644
--- a/lib/libkvm/kvm.c
+++ b/lib/libkvm/kvm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm.c,v 1.65 2018/05/03 16:42:07 zhuk Exp $ */
+/* $OpenBSD: kvm.c,v 1.66 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: kvm.c,v 1.43 1996/05/05 04:31:59 gwr Exp $ */
/*-
@@ -219,11 +219,11 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
if (mf == 0)
mf = _PATH_MEM;
- if ((kd->pmfd = open(mf, flag)) < 0) {
+ if ((kd->pmfd = open(mf, flag)) == -1) {
_kvm_syserr(kd, kd->program, "%s", mf);
goto failed;
}
- if (fstat(kd->pmfd, &st) < 0) {
+ if (fstat(kd->pmfd, &st) == -1) {
_kvm_syserr(kd, kd->program, "%s", mf);
goto failed;
}
@@ -239,12 +239,12 @@ _kvm_open(kvm_t *kd, const char *uf, const char *mf, const char *sf,
"%s: not physical memory device", mf);
goto failed;
}
- if ((kd->vmfd = open(_PATH_KMEM, flag)) < 0) {
+ if ((kd->vmfd = open(_PATH_KMEM, flag)) == -1) {
_kvm_syserr(kd, kd->program, "%s", _PATH_KMEM);
goto failed;
}
kd->alive = 1;
- if (sf != NULL && (kd->swfd = open(sf, flag)) < 0) {
+ if (sf != NULL && (kd->swfd = open(sf, flag)) == -1) {
_kvm_syserr(kd, kd->program, "%s", sf);
goto failed;
}
diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c
index a18e9983ae0..f2733ccfc26 100644
--- a/lib/libkvm/kvm_proc.c
+++ b/lib/libkvm/kvm_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_proc.c,v 1.59 2018/05/03 15:47:41 zhuk Exp $ */
+/* $OpenBSD: kvm_proc.c,v 1.60 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: kvm_proc.c,v 1.30 1999/03/24 05:50:50 mrg Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -491,7 +491,7 @@ again:
mib[3] = isenv ? KERN_PROC_ENV : KERN_PROC_ARGV;
len = orglen;
- ret = (sysctl(mib, 4, *pargbuf, &len, NULL, 0) < 0);
+ ret = (sysctl(mib, 4, *pargbuf, &len, NULL, 0) == -1);
if (ret && errno == ENOMEM) {
buf = _kvm_reallocarray(kd, *pargbuf, orglen, 2);
if (buf == NULL)
diff --git a/lib/libossaudio/ossaudio.c b/lib/libossaudio/ossaudio.c
index 8bfcd2c9777..8374af54830 100644
--- a/lib/libossaudio/ossaudio.c
+++ b/lib/libossaudio/ossaudio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ossaudio.c,v 1.19 2018/10/26 14:46:05 miko Exp $ */
+/* $OpenBSD: ossaudio.c,v 1.20 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: ossaudio.c,v 1.14 2001/05/10 01:53:48 augustss Exp $ */
/*-
@@ -194,7 +194,7 @@ getdevinfo(int fd)
}
for(i = 0; i < MAX_MIXER_DEVS; i++) {
mi.index = i;
- if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
+ if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) == -1)
break;
switch(mi.type) {
case AUDIO_MIXER_VALUE:
@@ -215,12 +215,12 @@ getdevinfo(int fd)
}
for(i = 0; i < MAX_MIXER_DEVS; i++) {
mi.index = i;
- if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
+ if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) == -1)
break;
if (strcmp(mi.label.name, AudioNsource) != 0)
continue;
cl.index = mi.mixer_class;
- if (ioctl(fd, AUDIO_MIXER_DEVINFO, &cl) < 0)
+ if (ioctl(fd, AUDIO_MIXER_DEVINFO, &cl) == -1)
break;
if ((cl.type != AUDIO_MIXER_CLASS) ||
(strcmp(cl.label.name, AudioCrecord) != 0))
@@ -274,7 +274,7 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
case SOUND_MIXER_INFO:
case SOUND_OLD_MIXER_INFO:
error = ioctl(fd, AUDIO_GETDEV, &adev);
- if (error)
+ if (error == -1)
return (error);
omi = argp;
if (com == SOUND_MIXER_INFO)
@@ -289,7 +289,7 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
if (di->caps & SOUND_CAP_EXCL_INPUT) {
mc.type = AUDIO_MIXER_ENUM;
retval = ioctl(fd, AUDIO_MIXER_READ, &mc);
- if (retval < 0)
+ if (retval == -1)
return retval;
e = opaque_to_enum(di, NULL, mc.un.ord);
if (e >= 0)
@@ -297,7 +297,7 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
} else {
mc.type = AUDIO_MIXER_SET;
retval = ioctl(fd, AUDIO_MIXER_READ, &mc);
- if (retval < 0)
+ if (retval == -1)
return retval;
e = opaque_to_enum(di, NULL, mc.un.mask);
if (e >= 0)
@@ -354,7 +354,7 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
doread:
mc.un.value.num_channels = di->stereomask & (1<<n) ? 2 : 1;
retval = ioctl(fd, AUDIO_MIXER_READ, &mc);
- if (retval < 0)
+ if (retval == -1)
return retval;
if (mc.type != AUDIO_MIXER_VALUE)
return EINVAL;
@@ -387,7 +387,7 @@ mixer_ioctl(int fd, unsigned long com, void *argp)
mc.un.value.level[AUDIO_MIXER_LEVEL_MONO] = (l+r)/2;
}
retval = ioctl(fd, AUDIO_MIXER_WRITE, &mc);
- if (retval < 0)
+ if (retval == -1)
return retval;
if (MIXER_WRITE(SOUND_MIXER_FIRST) <= com &&
com < MIXER_WRITE(SOUND_MIXER_NRDEVICES))
diff --git a/lib/libpcap/inet.c b/lib/libpcap/inet.c
index 2a3da9d1d50..0aa3ef8c379 100644
--- a/lib/libpcap/inet.c
+++ b/lib/libpcap/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.24 2015/12/22 19:51:04 mmcc Exp $ */
+/* $OpenBSD: inet.c,v 1.25 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 1994, 1995, 1996, 1997, 1998
@@ -161,7 +161,7 @@ pcap_lookupdev(errbuf)
static char device[sizeof(ifrp->ifr_name) + 1];
fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd < 0) {
+ if (fd == -1) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
pcap_strerror(errno));
return (NULL);
@@ -170,7 +170,7 @@ pcap_lookupdev(errbuf)
ifc.ifc_buf = (caddr_t)ibuf;
memset((char *)ibuf, 0, sizeof(ibuf));
- if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0 ||
+ if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) == -1 ||
ifc.ifc_len < sizeof(struct ifreq)) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFCONF: %s",
pcap_strerror(errno));
@@ -202,7 +202,7 @@ pcap_lookupdev(errbuf)
*/
(void)strlcpy(ifr.ifr_name, ifrp->ifr_name,
sizeof(ifr.ifr_name));
- if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifr) < 0) {
+ if (ioctl(fd, SIOCGIFFLAGS, (char *)&ifr) == -1) {
if (errno == ENXIO)
continue;
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
@@ -247,7 +247,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp,
struct ifreq ifr;
fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (fd < 0) {
+ if (fd == -1) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "socket: %s",
pcap_strerror(errno));
return (-1);
@@ -258,7 +258,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp,
ifr.ifr_addr.sa_family = AF_INET;
#endif
(void)strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
- if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
+ if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) == -1) {
if (errno == EADDRNOTAVAIL) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"%s: no IPv4 address assigned", device);
@@ -272,7 +272,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp,
}
sin = (struct sockaddr_in *)&ifr.ifr_addr;
*netp = sin->sin_addr.s_addr;
- if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) < 0) {
+ if (ioctl(fd, SIOCGIFNETMASK, (char *)&ifr) == -1) {
(void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
"SIOCGIFNETMASK: %s: %s", device, pcap_strerror(errno));
(void)close(fd);
diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c
index c2b4a83f4a9..068580f98c6 100644
--- a/lib/libpcap/pcap-bpf.c
+++ b/lib/libpcap/pcap-bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcap-bpf.c,v 1.36 2018/04/05 03:47:27 lteo Exp $ */
+/* $OpenBSD: pcap-bpf.c,v 1.37 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1996, 1998
@@ -55,7 +55,7 @@ pcap_stats(pcap_t *p, struct pcap_stat *ps)
{
struct bpf_stat s;
- if (ioctl(p->fd, BIOCGSTATS, (caddr_t)&s) < 0) {
+ if (ioctl(p->fd, BIOCGSTATS, (caddr_t)&s) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGSTATS: %s",
pcap_strerror(errno));
return (PCAP_ERROR);
@@ -90,7 +90,7 @@ pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
cc = p->cc;
if (p->cc == 0) {
cc = read(p->fd, (char *)p->buffer, p->bufsize);
- if (cc < 0) {
+ if (cc == -1) {
/* Don't choke when we get ptraced */
switch (errno) {
@@ -246,7 +246,7 @@ get_dlt_list(int fd, int v, struct bpf_dltlist *bdlp, char *ebuf)
return (PCAP_ERROR);
}
- if (ioctl(fd, BIOCGDLTLIST, (caddr_t)bdlp) < 0) {
+ if (ioctl(fd, BIOCGDLTLIST, (caddr_t)bdlp) == -1) {
(void)snprintf(ebuf, PCAP_ERRBUF_SIZE,
"BIOCGDLTLIST: %s", pcap_strerror(errno));
free(bdlp->bfl_list);
@@ -321,7 +321,7 @@ pcap_cleanup_bpf(pcap_t *p)
memset(&req, 0, sizeof(req));
(void)strlcpy(req.ifm_name, p->opt.source,
sizeof(req.ifm_name));
- if (ioctl(sock, SIOCGIFMEDIA, &req) < 0) {
+ if (ioctl(sock, SIOCGIFMEDIA, &req) == -1) {
fprintf(stderr,
"Can't restore interface flags "
"(SIOCGIFMEDIA failed: %s).\n"
@@ -437,7 +437,7 @@ pcap_activate(pcap_t *p)
p->fd = fd;
- if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0) {
+ if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCVERSION: %s",
pcap_strerror(errno));
status = PCAP_ERROR;
@@ -470,7 +470,7 @@ pcap_activate(pcap_t *p)
* A buffer size was explicitly specified; use it.
*/
if (ioctl(fd, BIOCSBLEN,
- (caddr_t)&p->opt.buffer_size) < 0) {
+ (caddr_t)&p->opt.buffer_size) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"BIOCSBLEN: %s: %s", p->opt.source,
pcap_strerror(errno));
@@ -483,12 +483,12 @@ pcap_activate(pcap_t *p)
* Now bind to the device.
*/
(void)strlcpy(ifr.ifr_name, p->opt.source, sizeof(ifr.ifr_name));
- if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
+ if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) == -1) {
status = check_setif_failure(p, errno);
goto bad;
}
/* Get the data link layer type. */
- if (ioctl(fd, BIOCGDLT, (caddr_t)&v) < 0) {
+ if (ioctl(fd, BIOCGDLT, (caddr_t)&v) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGDLT: %s",
pcap_strerror(errno));
status = PCAP_ERROR;
@@ -557,7 +557,7 @@ pcap_activate(pcap_t *p)
struct timeval to;
to.tv_sec = p->md.timeout / 1000;
to.tv_usec = (p->md.timeout * 1000) % 1000000;
- if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&to) < 0) {
+ if (ioctl(p->fd, BIOCSRTIMEOUT, (caddr_t)&to) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"BIOCSRTIMEOUT: %s", pcap_strerror(errno));
status = PCAP_ERROR;
@@ -567,7 +567,7 @@ pcap_activate(pcap_t *p)
if (p->opt.immediate) {
v = 1;
- if (ioctl(p->fd, BIOCIMMEDIATE, &v) < 0) {
+ if (ioctl(p->fd, BIOCIMMEDIATE, &v) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
"BIOCIMMEDIATE: %s", pcap_strerror(errno));
status = PCAP_ERROR;
@@ -577,14 +577,14 @@ pcap_activate(pcap_t *p)
if (p->opt.promisc) {
/* set promiscuous mode, just warn if it fails */
- if (ioctl(p->fd, BIOCPROMISC, NULL) < 0) {
+ if (ioctl(p->fd, BIOCPROMISC, NULL) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCPROMISC: %s",
pcap_strerror(errno));
status = PCAP_WARNING_PROMISC_NOTSUP;
}
}
- if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) < 0) {
+ if (ioctl(fd, BIOCGBLEN, (caddr_t)&v) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCGBLEN: %s",
pcap_strerror(errno));
status = PCAP_ERROR;
@@ -645,7 +645,7 @@ monitor_mode(pcap_t *p, int set)
/*
* Find out how many media types we have.
*/
- if (ioctl(sock, SIOCGIFMEDIA, &req) < 0) {
+ if (ioctl(sock, SIOCGIFMEDIA, &req) == -1) {
/*
* Can't get the media types.
*/
@@ -693,7 +693,7 @@ monitor_mode(pcap_t *p, int set)
return (PCAP_ERROR);
}
req.ifm_ulist = media_list;
- if (ioctl(sock, SIOCGIFMEDIA, &req) < 0) {
+ if (ioctl(sock, SIOCGIFMEDIA, &req) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "SIOCGIFMEDIA: %s",
pcap_strerror(errno));
free(media_list);
@@ -931,7 +931,7 @@ pcap_setfilter(pcap_t *p, struct bpf_program *fp)
}
memcpy(p->fcode.bf_insns, fp->bf_insns,
fp->bf_len * sizeof(*fp->bf_insns));
- } else if (ioctl(p->fd, BIOCSETF, (caddr_t)fp) < 0) {
+ } else if (ioctl(p->fd, BIOCSETF, (caddr_t)fp) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETF: %s",
pcap_strerror(errno));
return (-1);
@@ -958,7 +958,7 @@ pcap_setdirection(pcap_t *p, pcap_direction_t d)
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Invalid direction");
return (-1);
}
- if (ioctl(p->fd, BIOCSDIRFILT, &dirfilt) < 0) {
+ if (ioctl(p->fd, BIOCSDIRFILT, &dirfilt) == -1) {
snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSDIRFILT: %s",
pcap_strerror(errno));
return (-1);
diff --git a/lib/libsndio/sio_sun.c b/lib/libsndio/sio_sun.c
index 08ad7489bc9..5ff939b7de4 100644
--- a/lib/libsndio/sio_sun.c
+++ b/lib/libsndio/sio_sun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_sun.c,v 1.27 2018/09/19 14:01:52 miko Exp $ */
+/* $OpenBSD: sio_sun.c,v 1.28 2019/06/28 13:32:42 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -79,12 +79,12 @@ sio_sun_adjpar(struct sio_sun_hdl *hdl, struct audio_swpar *ap)
{
if (hdl->sio.eof)
return 0;
- if (ioctl(hdl->fd, AUDIO_SETPAR, ap)) {
+ if (ioctl(hdl->fd, AUDIO_SETPAR, ap) == -1) {
DPERROR("AUDIO_SETPAR");
hdl->sio.eof = 1;
return 0;
}
- if (ioctl(hdl->fd, AUDIO_GETPAR, ap)) {
+ if (ioctl(hdl->fd, AUDIO_GETPAR, ap) == -1) {
DPERROR("AUDIO_GETPAR");
hdl->sio.eof = 1;
return 0;
@@ -163,7 +163,7 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
unsigned int enc_map = 0, rchan_map = 0, pchan_map = 0, rate_map;
unsigned int i, j, conf;
- if (ioctl(hdl->fd, AUDIO_GETPAR, &savepar)) {
+ if (ioctl(hdl->fd, AUDIO_GETPAR, &savepar) == -1) {
DPERROR("AUDIO_GETPAR");
hdl->sio.eof = 1;
return 0;
@@ -256,7 +256,7 @@ sio_sun_getcap(struct sio_hdl *sh, struct sio_cap *cap)
}
cap->nconf = nconf;
- if (ioctl(hdl->fd, AUDIO_SETPAR, &savepar)) {
+ if (ioctl(hdl->fd, AUDIO_SETPAR, &savepar) == -1) {
DPERROR("AUDIO_SETPAR");
hdl->sio.eof = 1;
return 0;
@@ -298,7 +298,7 @@ sio_sun_getfd(const char *str, unsigned int mode, int nbio)
flags = O_RDWR;
else
flags = (mode & SIO_PLAY) ? O_WRONLY : O_RDONLY;
- while ((fd = open(path, flags | O_NONBLOCK | O_CLOEXEC)) < 0) {
+ while ((fd = open(path, flags | O_NONBLOCK | O_CLOEXEC)) == -1) {
if (errno == EINTR)
continue;
DPERROR(path);
@@ -323,7 +323,7 @@ sio_sun_fdopen(int fd, unsigned int mode, int nbio)
/*
* pause the device
*/
- if (ioctl(fd, AUDIO_STOP) < 0) {
+ if (ioctl(fd, AUDIO_STOP) == -1) {
DPERROR("AUDIO_STOP");
free(hdl);
return NULL;
@@ -340,12 +340,12 @@ _sio_sun_open(const char *str, unsigned int mode, int nbio)
int fd;
fd = sio_sun_getfd(str, mode, nbio);
- if (fd < 0)
+ if (fd == -1)
return NULL;
hdl = sio_sun_fdopen(fd, mode, nbio);
if (hdl != NULL)
return hdl;
- while (close(fd) < 0 && errno == EINTR)
+ while (close(fd) == -1 && errno == EINTR)
; /* retry */
return NULL;
}
@@ -355,7 +355,7 @@ sio_sun_close(struct sio_hdl *sh)
{
struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh;
- while (close(hdl->fd) < 0 && errno == EINTR)
+ while (close(hdl->fd) == -1 && errno == EINTR)
; /* retry */
free(hdl);
}
@@ -384,7 +384,7 @@ sio_sun_start(struct sio_hdl *sh)
/*
* no play buffers to fill, start now!
*/
- if (ioctl(hdl->fd, AUDIO_START) < 0) {
+ if (ioctl(hdl->fd, AUDIO_START) == -1) {
DPERROR("AUDIO_START");
hdl->sio.eof = 1;
return 0;
@@ -403,7 +403,7 @@ sio_sun_stop(struct sio_hdl *sh)
hdl->filling = 0;
return 1;
}
- if (ioctl(hdl->fd, AUDIO_STOP) < 0) {
+ if (ioctl(hdl->fd, AUDIO_STOP) == -1) {
DPERROR("AUDIO_STOP");
hdl->sio.eof = 1;
return 0;
@@ -438,7 +438,7 @@ sio_sun_setpar(struct sio_hdl *sh, struct sio_par *par)
ap.round = par->appbufsz / 2;
ap.nblks = 2;
}
- if (ioctl(hdl->fd, AUDIO_SETPAR, &ap) < 0) {
+ if (ioctl(hdl->fd, AUDIO_SETPAR, &ap) == -1) {
DPERROR("AUDIO_SETPAR");
hdl->sio.eof = 1;
return 0;
@@ -452,7 +452,7 @@ sio_sun_getpar(struct sio_hdl *sh, struct sio_par *par)
struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh;
struct audio_swpar ap;
- if (ioctl(hdl->fd, AUDIO_GETPAR, &ap) < 0) {
+ if (ioctl(hdl->fd, AUDIO_GETPAR, &ap) == -1) {
DPERROR("AUDIO_GETPAR");
hdl->sio.eof = 1;
return 0;
@@ -477,7 +477,7 @@ sio_sun_read(struct sio_hdl *sh, void *buf, size_t len)
struct sio_sun_hdl *hdl = (struct sio_sun_hdl *)sh;
ssize_t n;
- while ((n = read(hdl->fd, buf, len)) < 0) {
+ while ((n = read(hdl->fd, buf, len)) == -1) {
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
@@ -502,7 +502,7 @@ sio_sun_write(struct sio_hdl *sh, const void *buf, size_t len)
ssize_t n, todo;
todo = len;
- while ((n = write(hdl->fd, data, todo)) < 0) {
+ while ((n = write(hdl->fd, data, todo)) == -1) {
if (errno == EINTR)
continue;
if (errno != EAGAIN) {
@@ -530,7 +530,7 @@ sio_sun_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events)
if (hdl->filling && hdl->sio.wused == hdl->sio.par.bufsz *
hdl->sio.par.pchan * hdl->sio.par.bps) {
hdl->filling = 0;
- if (ioctl(hdl->fd, AUDIO_START) < 0) {
+ if (ioctl(hdl->fd, AUDIO_START) == -1) {
DPERROR("AUDIO_START");
hdl->sio.eof = 1;
return 0;
@@ -551,7 +551,7 @@ sio_sun_revents(struct sio_hdl *sh, struct pollfd *pfd)
if ((pfd->revents & POLLHUP) ||
(pfd->revents & (POLLIN | POLLOUT)) == 0)
return pfd->revents;
- if (ioctl(hdl->fd, AUDIO_GETPOS, &ap) < 0) {
+ if (ioctl(hdl->fd, AUDIO_GETPOS, &ap) == -1) {
DPERROR("sio_sun_revents: GETPOS");
hdl->sio.eof = 1;
return POLLHUP;
diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c
index 11972c2259c..9d81c2f0e3f 100644
--- a/lib/libusbhid/descr.c
+++ b/lib/libusbhid/descr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: descr.c,v 1.6 2012/07/16 19:57:17 jasper Exp $ */
+/* $OpenBSD: descr.c,v 1.7 2019/06/28 13:32:42 deraadt Exp $ */
/* $NetBSD: descr.c,v 1.2 2002/02/20 20:31:07 christos Exp $ */
/*
@@ -46,7 +46,7 @@ hid_get_report_desc(int fd)
struct usb_ctl_report_desc rep;
rep.ucrd_size = 0;
- if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
+ if (ioctl(fd, USB_GET_REPORT_DESC, &rep) == -1)
return (NULL);
return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);
diff --git a/lib/libutil/check_expire.c b/lib/libutil/check_expire.c
index 7379cdbe8a8..ebbaa2acd2b 100644
--- a/lib/libutil/check_expire.c
+++ b/lib/libutil/check_expire.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_expire.c,v 1.12 2015/11/26 23:32:52 millert Exp $ */
+/* $OpenBSD: check_expire.c,v 1.13 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -166,7 +166,7 @@ pwd_update(const struct passwd *pwd, const struct passwd *opwd)
pw_init();
tfd = pw_lock(0);
- if (tfd < 0) {
+ if (tfd == -1) {
if (errno == EEXIST)
return("the passwd file is busy.");
else
@@ -174,13 +174,13 @@ pwd_update(const struct passwd *pwd, const struct passwd *opwd)
}
pfd = open(_PATH_MASTERPASSWD, O_RDONLY|O_CLOEXEC, 0);
- if (pfd < 0) {
+ if (pfd == -1) {
pw_abort();
return(strerror(errno));
}
pw_copy(pfd, tfd, pwd, opwd);
- if (pw_mkdb(pwd->pw_name, 0) < 0) {
+ if (pw_mkdb(pwd->pw_name, 0) == -1) {
pw_abort();
return("unable to update password database");
}
diff --git a/lib/libutil/getmaxpartitions.c b/lib/libutil/getmaxpartitions.c
index 22f3c8d3cc6..dd9d2bc6b3b 100644
--- a/lib/libutil/getmaxpartitions.c
+++ b/lib/libutil/getmaxpartitions.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getmaxpartitions.c,v 1.9 2016/08/27 03:54:20 guenther Exp $ */
+/* $OpenBSD: getmaxpartitions.c,v 1.10 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: getmaxpartitions.c,v 1.1 1996/05/16 07:03:31 thorpej Exp $ */
/*-
@@ -45,7 +45,7 @@ getmaxpartitions(void)
mib[0] = CTL_KERN;
mib[1] = KERN_MAXPARTITIONS;
varlen = sizeof(maxpart);
- if (sysctl(mib, 2, &maxpart, &varlen, NULL, (size_t)0) < 0)
+ if (sysctl(mib, 2, &maxpart, &varlen, NULL, (size_t)0) == -1)
return (-1);
return (maxpart);
diff --git a/lib/libutil/getrawpartition.c b/lib/libutil/getrawpartition.c
index 10324472bd2..bc7fa06d5f1 100644
--- a/lib/libutil/getrawpartition.c
+++ b/lib/libutil/getrawpartition.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getrawpartition.c,v 1.9 2016/08/27 03:54:20 guenther Exp $ */
+/* $OpenBSD: getrawpartition.c,v 1.10 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: getrawpartition.c,v 1.1 1996/05/16 07:03:33 thorpej Exp $ */
/*-
@@ -45,7 +45,7 @@ getrawpartition(void)
mib[0] = CTL_KERN;
mib[1] = KERN_RAWPARTITION;
varlen = sizeof(rawpart);
- if (sysctl(mib, 2, &rawpart, &varlen, NULL, (size_t)0) < 0)
+ if (sysctl(mib, 2, &rawpart, &varlen, NULL, (size_t)0) == -1)
return (-1);
return (rawpart);
diff --git a/lib/libutil/logout.c b/lib/libutil/logout.c
index 13c11fa863f..c2b6818610f 100644
--- a/lib/libutil/logout.c
+++ b/lib/libutil/logout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logout.c,v 1.9 2015/12/28 20:11:36 guenther Exp $ */
+/* $OpenBSD: logout.c,v 1.10 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -47,7 +47,7 @@ logout(const char *line)
int fd, rval;
UTMP ut;
- if ((fd = open(_PATH_UTMP, O_RDWR|O_CLOEXEC)) < 0)
+ if ((fd = open(_PATH_UTMP, O_RDWR|O_CLOEXEC)) == -1)
return(0);
rval = 0;
while (read(fd, &ut, sizeof(UTMP)) == sizeof(UTMP)) {
diff --git a/lib/libutil/logwtmp.c b/lib/libutil/logwtmp.c
index decde069377..1223d7a4b57 100644
--- a/lib/libutil/logwtmp.c
+++ b/lib/libutil/logwtmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logwtmp.c,v 1.10 2016/08/30 14:44:45 guenther Exp $ */
+/* $OpenBSD: logwtmp.c,v 1.11 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -46,7 +46,7 @@ logwtmp(const char *line, const char *name, const char *host)
struct utmp ut;
int fd;
- if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND|O_CLOEXEC)) < 0)
+ if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND|O_CLOEXEC)) == -1)
return;
if (fstat(fd, &buf) == 0) {
(void) strncpy(ut.ut_line, line, sizeof(ut.ut_line));
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index cd2929428ea..7acd7085d42 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.55 2018/08/10 17:03:26 deraadt Exp $ */
+/* $OpenBSD: passwd.c,v 1.56 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -101,7 +101,7 @@ pw_lock(int retries)
/* Acquire the lock file. */
old_mode = umask(0);
fd = open(pw_lck, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0600);
- for (i = 0; i < retries && fd < 0 && errno == EEXIST; i++) {
+ for (i = 0; i < retries && fd == -1 && errno == EEXIST; i++) {
sleep(1);
fd = open(pw_lck, O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0600);
}
diff --git a/lib/libutil/readlabel.c b/lib/libutil/readlabel.c
index d53820e67ac..9d811b5c9cf 100644
--- a/lib/libutil/readlabel.c
+++ b/lib/libutil/readlabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readlabel.c,v 1.14 2016/08/30 14:44:45 guenther Exp $ */
+/* $OpenBSD: readlabel.c,v 1.15 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -74,7 +74,7 @@ readlabelfs(char *device, int verbose)
}
/* Assuming device is of the form /dev/??p, build a raw partition. */
- if (stat(device, &sbuf) < 0) {
+ if (stat(device, &sbuf) == -1) {
if (verbose)
warn("%s", device);
return (NULL);
@@ -106,12 +106,12 @@ readlabelfs(char *device, int verbose)
/* If rpath doesn't exist, change that partition back. */
fd = open(rpath, O_RDONLY|O_CLOEXEC);
- if (fd < 0) {
+ if (fd == -1) {
if (errno == ENOENT) {
rpath[strlen(rpath) - 1] = part;
fd = open(rpath, O_RDONLY|O_CLOEXEC);
- if (fd < 0) {
+ if (fd == -1) {
if (verbose)
warn("%s", rpath);
return (NULL);
@@ -125,7 +125,7 @@ readlabelfs(char *device, int verbose)
disklabel:
- if (ioctl(fd, DIOCGDINFO, &dk) < 0) {
+ if (ioctl(fd, DIOCGDINFO, &dk) == -1) {
if (verbose)
warn("%s: couldn't read disklabel", rpath);
close(fd);
diff --git a/lib/libutil/uucplock.c b/lib/libutil/uucplock.c
index f38382282ba..0ec649421ab 100644
--- a/lib/libutil/uucplock.c
+++ b/lib/libutil/uucplock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uucplock.c,v 1.19 2016/08/30 14:52:09 guenther Exp $ */
+/* $OpenBSD: uucplock.c,v 1.20 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -71,11 +71,11 @@ uu_lock(const char *ttyname)
(void)snprintf(lckname, sizeof(lckname), _PATH_UUCPLOCK LOCKFMT,
ttyname);
tmpfd = open(lcktmpname, O_CREAT|O_TRUNC|O_WRONLY|O_CLOEXEC, 0664);
- if (tmpfd < 0)
+ if (tmpfd == -1)
GORET(0, UU_LOCK_CREAT_ERR);
for (i = 0; i < MAXTRIES; i++) {
- if (link(lcktmpname, lckname) < 0) {
+ if (link(lcktmpname, lckname) == -1) {
if (errno != EEXIST)
GORET(1, UU_LOCK_LINK_ERR);
/*
@@ -83,7 +83,7 @@ uu_lock(const char *ttyname)
* check to see if the process holding the lock
* still exists
*/
- if ((fd = open(lckname, O_RDONLY | O_CLOEXEC)) < 0)
+ if ((fd = open(lckname, O_RDONLY | O_CLOEXEC)) == -1)
GORET(1, UU_LOCK_OPEN_ERR);
if ((pid_old = get_pid(fd, &err)) == -1)
@@ -127,7 +127,7 @@ uu_lock_txfr(const char *ttyname, pid_t pid)
snprintf(lckname, sizeof(lckname), _PATH_UUCPLOCK LOCKFMT, ttyname);
- if ((fd = open(lckname, O_RDWR | O_CLOEXEC)) < 0)
+ if ((fd = open(lckname, O_RDWR | O_CLOEXEC)) == -1)
return UU_LOCK_OWNER_ERR;
if (get_pid(fd, &err) != getpid())
ret = UU_LOCK_OWNER_ERR;
diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c
index 647b6f57cbc..f1de0bef5e0 100644
--- a/libexec/fingerd/fingerd.c
+++ b/libexec/fingerd/fingerd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fingerd.c,v 1.40 2018/08/03 15:14:18 deraadt Exp $ */
+/* $OpenBSD: fingerd.c,v 1.41 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
socklen_t sval;
sval = sizeof(ss);
- if (getpeername(0, (struct sockaddr *)&ss, &sval) < 0)
+ if (getpeername(0, (struct sockaddr *)&ss, &sval) == -1)
err(1, "getpeername");
sa = (struct sockaddr *)&ss;
@@ -197,7 +197,7 @@ main(int argc, char *argv[])
}
}
- if (pipe(p) < 0)
+ if (pipe(p) == -1)
logerr("pipe: %s", strerror(errno));
switch (vfork()) {
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index c81a3b7c30f..3012d7c82ac 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpcmd.y,v 1.67 2019/05/08 23:56:48 tedu Exp $ */
+/* $OpenBSD: ftpcmd.y,v 1.68 2019/06/28 13:32:53 deraadt Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
@@ -530,7 +530,7 @@ cmd
reply(550,
"No permission to change mode of %s.",
$8);
- else if (chmod($8, $6) < 0)
+ else if (chmod($8, $6) == -1)
perror_reply(550, $8);
else
reply(200,
@@ -605,7 +605,7 @@ cmd
{
if ($2 && $4 != NULL) {
struct stat stbuf;
- if (stat($4, &stbuf) < 0)
+ if (stat($4, &stbuf) == -1)
reply(550, "%s: %s",
$4, strerror(errno));
else if (!S_ISREG(stbuf.st_mode)) {
@@ -1514,7 +1514,7 @@ sizecmd(filename)
case TYPE_L:
case TYPE_I: {
struct stat stbuf;
- if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
+ if (stat(filename, &stbuf) == -1 || !S_ISREG(stbuf.st_mode))
reply(550, "%s: not a plain file.", filename);
else
reply(213, "%lld", (long long)stbuf.st_size);
@@ -1529,7 +1529,7 @@ sizecmd(filename)
perror_reply(550, filename);
return;
}
- if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
+ if (fstat(fileno(fin), &stbuf) == -1 || !S_ISREG(stbuf.st_mode)) {
reply(550, "%s: not a plain file.", filename);
(void) fclose(fin);
return;
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index d20c3a4bf8d..eff1cd1099a 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.226 2019/05/08 23:56:48 tedu Exp $ */
+/* $OpenBSD: ftpd.c,v 1.227 2019/06/28 13:32:53 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -398,7 +398,7 @@ main(int argc, char *argv[])
/*
* Detach from parent.
*/
- if (daemon(1, 1) < 0) {
+ if (daemon(1, 1) == -1) {
syslog(LOG_ERR, "failed to become a daemon");
exit(1);
}
@@ -435,29 +435,29 @@ main(int argc, char *argv[])
for (res = res0; res; res = res->ai_next) {
fds[n] = socket(res->ai_family, res->ai_socktype,
res->ai_protocol);
- if (fds[n] < 0)
+ if (fds[n] == -1)
continue;
if (setsockopt(fds[n], SOL_SOCKET, SO_KEEPALIVE,
- &on, sizeof(on)) < 0) {
+ &on, sizeof(on)) == -1) {
close(fds[n]);
fds[n] = -1;
continue;
}
if (setsockopt(fds[n], SOL_SOCKET, SO_REUSEADDR,
- &on, sizeof(on)) < 0) {
+ &on, sizeof(on)) == -1) {
close(fds[n]);
fds[n] = -1;
continue;
}
- if (bind(fds[n], res->ai_addr, res->ai_addrlen) < 0) {
+ if (bind(fds[n], res->ai_addr, res->ai_addrlen) == -1) {
close(fds[n]);
fds[n] = -1;
continue;
}
- if (listen(fds[n], 32) < 0) {
+ if (listen(fds[n], 32) == -1) {
close(fds[n]);
fds[n] = -1;
continue;
@@ -479,7 +479,7 @@ main(int argc, char *argv[])
* children to handle them.
*/
while (1) {
- if (poll(pfds, n, INFTIM) < 0) {
+ if (poll(pfds, n, INFTIM) == -1) {
if (errno == EINTR)
continue;
syslog(LOG_ERR, "poll: %m");
@@ -508,7 +508,7 @@ main(int argc, char *argv[])
} else {
addrlen = sizeof(his_addr);
if (getpeername(0, (struct sockaddr *)&his_addr,
- &addrlen) < 0) {
+ &addrlen) == -1) {
/* syslog(LOG_ERR, "getpeername (%s): %m", argv[0]); */
exit(1);
}
@@ -520,7 +520,7 @@ main(int argc, char *argv[])
set_slave_signals();
addrlen = sizeof(ctrl_addr);
- if (getsockname(0, (struct sockaddr *)&ctrl_addr, &addrlen) < 0) {
+ if (getsockname(0, (struct sockaddr *)&ctrl_addr, &addrlen) == -1) {
syslog(LOG_ERR, "getsockname: %m");
exit(1);
}
@@ -535,19 +535,19 @@ main(int argc, char *argv[])
switch (his_addr.su_family) {
case AF_INET:
if (setsockopt(0, IPPROTO_IP, IP_TOS, &tos,
- sizeof(int)) < 0)
+ sizeof(int)) == -1)
syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
break;
case AF_INET6:
if (setsockopt(0, IPPROTO_IPV6, IPV6_TCLASS, &tos,
- sizeof(int)) < 0)
+ sizeof(int)) == -1)
syslog(LOG_WARNING, "setsockopt (IPV6_TCLASS): %m");
break;
}
data_source.su_port = htons(ntohs(ctrl_addr.su_port) - 1);
/* Try to handle urgent data inline */
- if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, &on, sizeof(on)) < 0)
+ if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, &on, sizeof(on)) == -1)
syslog(LOG_ERR, "setsockopt: %m");
dolog((struct sockaddr *)&his_addr);
@@ -971,7 +971,7 @@ pass(char *passwd)
/* open stats file before chroot */
if (guest && (stats == 1) && (statfd < 0))
- if ((statfd = open(_PATH_FTPDSTATFILE, O_WRONLY|O_APPEND)) < 0)
+ if ((statfd = open(_PATH_FTPDSTATFILE, O_WRONLY|O_APPEND)) == -1)
stats = 0;
logged_in = 1;
@@ -1006,7 +1006,7 @@ pass(char *passwd)
/* Compute root directory. */
snprintf(rootdir, sizeof(rootdir), "%s/%s",
pw->pw_dir, dhostname);
- if (stat(rootdir, &ts) < 0) {
+ if (stat(rootdir, &ts) == -1) {
snprintf(rootdir, sizeof(rootdir), "%s/%s",
pw->pw_dir, hostname);
}
@@ -1019,7 +1019,7 @@ pass(char *passwd)
* the old current directory will be accessible as "."
* outside the new root!
*/
- if (chroot(rootdir) < 0 || chdir("/") < 0) {
+ if (chroot(rootdir) == -1 || chdir("/") == -1) {
reply(550, "Can't set guest privileges.");
goto bad;
}
@@ -1029,7 +1029,7 @@ pass(char *passwd)
goto bad;
}
} else if (dochroot) {
- if (chroot(rootdir) < 0 || chdir("/") < 0) {
+ if (chroot(rootdir) == -1 || chdir("/") == -1) {
reply(550, "Can't change root.");
goto bad;
}
@@ -1038,19 +1038,19 @@ pass(char *passwd)
reply(550, "Can't setup environment.");
goto bad;
}
- } else if (chdir(pw->pw_dir) < 0) {
- if (chdir("/") < 0) {
+ } else if (chdir(pw->pw_dir) == -1) {
+ if (chdir("/") == -1) {
reply(530, "User %s: can't change directory to %s.",
pw->pw_name, pw->pw_dir);
goto bad;
} else
lreply(230, "No directory! Logging in with home=/");
}
- if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0) {
+ if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) {
reply(550, "Can't set gid.");
goto bad;
}
- if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) {
+ if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) == -1) {
reply(550, "Can't set uid.");
goto bad;
}
@@ -1139,7 +1139,7 @@ retrieve(enum ret_cmd cmd, char *name)
}
byte_count = -1;
if (cmd == RET_FILE &&
- (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
+ (fstat(fileno(fin), &st) == -1 || !S_ISREG(st.st_mode))) {
reply(550, "%s: not a plain file.", name);
goto done;
}
@@ -1161,7 +1161,7 @@ retrieve(enum ret_cmd cmd, char *name)
if (c == '\n')
i++;
}
- } else if (lseek(fileno(fin), restart_point, SEEK_SET) < 0) {
+ } else if (lseek(fileno(fin), restart_point, SEEK_SET) == -1) {
perror_reply(550, name);
goto done;
}
@@ -1242,11 +1242,11 @@ store(char *name, char *mode, int unique)
* because we are changing from reading to
* writing.
*/
- if (fseek(fout, 0, SEEK_CUR) < 0) {
+ if (fseek(fout, 0, SEEK_CUR) == -1) {
perror_reply(550, name);
goto done;
}
- } else if (lseek(fileno(fout), restart_point, SEEK_SET) < 0) {
+ } else if (lseek(fileno(fout), restart_point, SEEK_SET) == -1) {
perror_reply(550, name);
goto done;
}
@@ -1282,7 +1282,7 @@ getdatasock(char *mode)
goto bad;
opt = 1;
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
- &opt, sizeof(opt)) < 0)
+ &opt, sizeof(opt)) == -1)
goto bad;
/* anchor socket to avoid multi-homing problems */
data_source = ctrl_addr;
@@ -1301,12 +1301,12 @@ getdatasock(char *mode)
switch (ctrl_addr.su_family) {
case AF_INET:
if (setsockopt(s, IPPROTO_IP, IP_TOS, &opt,
- sizeof(opt)) < 0)
+ sizeof(opt)) == -1)
syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
break;
case AF_INET6:
if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &opt,
- sizeof(opt)) < 0)
+ sizeof(opt)) == -1)
syslog(LOG_WARNING, "setsockopt (IPV6_TCLASS): %m");
break;
}
@@ -1317,10 +1317,10 @@ getdatasock(char *mode)
* in heavy-load situations.
*/
opt = 1;
- if (setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, &opt, sizeof(opt)) < 0)
+ if (setsockopt(s, IPPROTO_TCP, TCP_NOPUSH, &opt, sizeof(opt)) == -1)
syslog(LOG_WARNING, "setsockopt (TCP_NOPUSH): %m");
opt = 65536;
- if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)) < 0)
+ if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)) == -1)
syslog(LOG_WARNING, "setsockopt (SO_SNDBUF): %m");
return (fdopen(s, mode));
@@ -1360,7 +1360,7 @@ dataconn(char *name, off_t size, char *mode)
(void) alarm ((unsigned) timeout);
s = accept(pdata, (struct sockaddr *)&from, &fromlen);
(void) alarm (0);
- if (s < 0) {
+ if (s == -1) {
reply(425, "Can't open data connection.");
(void) close(pdata);
pdata = -1;
@@ -1590,7 +1590,7 @@ oldway:
transflag = 0;
(void)free(buf);
if (cnt != 0) {
- if (cnt < 0)
+ if (cnt == -1)
goto file_err;
goto data_err;
}
@@ -1658,7 +1658,7 @@ receive_data(FILE *instr, FILE *outstr)
}
} while (cnt > 0);
(void) sigaction(SIGALRM, &sa_saved, NULL);
- if (cnt < 0)
+ if (cnt == -1)
goto data_err;
transflag = 0;
return (0);
@@ -1995,18 +1995,18 @@ delete(char *name)
struct stat st;
LOGCMD("delete", name);
- if (stat(name, &st) < 0) {
+ if (stat(name, &st) == -1) {
perror_reply(550, name);
return;
}
if ((st.st_mode&S_IFMT) == S_IFDIR) {
- if (rmdir(name) < 0) {
+ if (rmdir(name) == -1) {
perror_reply(550, name);
return;
}
goto done;
}
- if (unlink(name) < 0) {
+ if (unlink(name) == -1) {
perror_reply(550, name);
return;
}
@@ -2019,7 +2019,7 @@ cwd(char *path)
{
FILE *message;
- if (chdir(path) < 0)
+ if (chdir(path) == -1)
perror_reply(550, path);
else {
if ((message = fopen(_PATH_CWDMESG, "r")) != NULL) {
@@ -2065,7 +2065,7 @@ makedir(char *name)
{
LOGCMD("mkdir", name);
- if (mkdir(name, 0777) < 0)
+ if (mkdir(name, 0777) == -1)
perror_reply(550, name);
else
replydirname(name, "directory created.");
@@ -2076,7 +2076,7 @@ removedir(char *name)
{
LOGCMD("rmdir", name);
- if (rmdir(name) < 0)
+ if (rmdir(name) == -1)
perror_reply(550, name);
else
ack("RMD");
@@ -2098,7 +2098,7 @@ renamefrom(char *name)
{
struct stat st;
- if (stat(name, &st) < 0) {
+ if (stat(name, &st) == -1) {
perror_reply(550, name);
return (NULL);
}
@@ -2111,7 +2111,7 @@ renamecmd(char *from, char *to)
{
LOGCMD2("rename", from, to);
- if (rename(from, to) < 0)
+ if (rename(from, to) == -1)
perror_reply(550, "rename");
else
ack("RNTO");
@@ -2233,30 +2233,30 @@ passive(void)
* resources.
*/
pdata = socket(AF_INET, SOCK_STREAM, 0);
- if (pdata < 0) {
+ if (pdata == -1) {
perror_reply(425, "Can't open passive connection");
return;
}
if (setsockopt(pdata, SOL_SOCKET, SO_KEEPALIVE,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
goto pasv_error;
on = IP_PORTRANGE_HIGH;
if (setsockopt(pdata, IPPROTO_IP, IP_PORTRANGE,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
goto pasv_error;
pasv_addr = ctrl_addr;
pasv_addr.su_sin.sin_port = 0;
if (bind(pdata, (struct sockaddr *)&pasv_addr,
- pasv_addr.su_len) < 0)
+ pasv_addr.su_len) == -1)
goto pasv_error;
len = sizeof(pasv_addr);
- if (getsockname(pdata, (struct sockaddr *)&pasv_addr, &len) < 0)
+ if (getsockname(pdata, (struct sockaddr *)&pasv_addr, &len) == -1)
goto pasv_error;
- if (listen(pdata, 1) < 0)
+ if (listen(pdata, 1) == -1)
goto pasv_error;
a = (u_char *)&pasv_addr.su_sin.sin_addr;
p = (u_char *)&pasv_addr.su_sin.sin_port;
@@ -2336,38 +2336,38 @@ long_passive(char *cmd, int pf)
* resources.
*/
pdata = socket(ctrl_addr.su_family, SOCK_STREAM, 0);
- if (pdata < 0) {
+ if (pdata == -1) {
perror_reply(425, "Can't open passive connection");
return;
}
if (setsockopt(pdata, SOL_SOCKET, SO_KEEPALIVE,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
goto pasv_error;
switch (ctrl_addr.su_family) {
case AF_INET:
on = IP_PORTRANGE_HIGH;
if (setsockopt(pdata, IPPROTO_IP, IP_PORTRANGE,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
goto pasv_error;
break;
case AF_INET6:
on = IPV6_PORTRANGE_HIGH;
if (setsockopt(pdata, IPPROTO_IPV6, IPV6_PORTRANGE,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
goto pasv_error;
break;
}
pasv_addr = ctrl_addr;
pasv_addr.su_port = 0;
- if (bind(pdata, (struct sockaddr *)&pasv_addr, pasv_addr.su_len) < 0)
+ if (bind(pdata, (struct sockaddr *)&pasv_addr, pasv_addr.su_len) == -1)
goto pasv_error;
len = pasv_addr.su_len;
- if (getsockname(pdata, (struct sockaddr *)&pasv_addr, &len) < 0)
+ if (getsockname(pdata, (struct sockaddr *)&pasv_addr, &len) == -1)
goto pasv_error;
- if (listen(pdata, 1) < 0)
+ if (listen(pdata, 1) == -1)
goto pasv_error;
p = (u_char *)&pasv_addr.su_port;
@@ -2545,7 +2545,7 @@ guniquefd(char *local, char **nam)
cp = strrchr(local, '/');
if (cp)
*cp = '\0';
- if (stat(cp ? local : ".", &st) < 0) {
+ if (stat(cp ? local : ".", &st) == -1) {
perror_reply(553, cp ? local : ".");
return (-1);
}
@@ -2619,7 +2619,7 @@ send_file_list(char *whichf)
}
while ((dirname = *dirlist++)) {
- if (stat(dirname, &st) < 0) {
+ if (stat(dirname, &st) == -1) {
/*
* If user typed "ls -l", etc, and the client
* used NLST, do what the user meant.
diff --git a/libexec/ftpd/logutmp.c b/libexec/ftpd/logutmp.c
index d0c86ef0151..b548aa00635 100644
--- a/libexec/ftpd/logutmp.c
+++ b/libexec/ftpd/logutmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logutmp.c,v 1.13 2016/08/14 22:57:31 guenther Exp $ */
+/* $OpenBSD: logutmp.c,v 1.14 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Portions Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -70,7 +70,7 @@ ftpd_login(struct utmp *ut)
topslot++;
}
if ((topslot < 0) || ((fd < 0) &&
- (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0))
+ (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) == -1))
return;
/*
diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c
index 4e62ac6dc91..708fb215c5f 100644
--- a/libexec/ftpd/logwtmp.c
+++ b/libexec/ftpd/logwtmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logwtmp.c,v 1.11 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: logwtmp.c,v 1.12 2019/06/28 13:32:53 deraadt Exp $ */
/* $NetBSD: logwtmp.c,v 1.4 1995/04/11 02:44:58 cgd Exp $ */
/*
@@ -60,7 +60,7 @@ ftpdlogwtmp(char *line, char *name, char *host)
struct stat buf;
struct utmp ut;
- if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) < 0)
+ if (fd < 0 && (fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) == -1)
return;
if (fstat(fd, &buf) == 0) {
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
diff --git a/libexec/ftpd/monitor.c b/libexec/ftpd/monitor.c
index 9a2fbc5f992..34d38e7fb7e 100644
--- a/libexec/ftpd/monitor.c
+++ b/libexec/ftpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.25 2017/04/17 21:48:26 deraadt Exp $ */
+/* $OpenBSD: monitor.c,v 1.26 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 2004 Moritz Jodeit <moritz@openbsd.org>
@@ -310,7 +310,7 @@ handle_cmds(void)
send_data(fd_slave, &slavequit,
sizeof(slavequit));
- while (waitpid(preauth_slave_pid, NULL, 0) < 0 &&
+ while (waitpid(preauth_slave_pid, NULL, 0) == -1 &&
errno == EINTR)
;
break;
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
index d1776eb95a9..cfbb9d81674 100644
--- a/libexec/ftpd/popen.c
+++ b/libexec/ftpd/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.27 2019/05/08 23:56:48 tedu Exp $ */
+/* $OpenBSD: popen.c,v 1.28 2019/06/28 13:32:53 deraadt Exp $ */
/* $NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $ */
/*
@@ -68,7 +68,7 @@ ftpd_ls(char *arg, char *path, pid_t *pidptr)
pid_t pid;
char **pop, *argv[MAX_ARGV], *gargv[MAX_GARGV];
- if (pipe(pdes) < 0)
+ if (pipe(pdes) == -1)
return (NULL);
/* break up string into pieces */
@@ -154,10 +154,10 @@ ftpd_pclose(FILE *iop, pid_t pid)
sigaddset(&sigset, SIGQUIT);
sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
- while ((rv = waitpid(pid, &status, 0)) < 0 && errno == EINTR)
+ while ((rv = waitpid(pid, &status, 0)) == -1 && errno == EINTR)
continue;
sigprocmask(SIG_SETMASK, &osigset, NULL);
- if (rv < 0)
+ if (rv == -1)
return (-1);
if (WIFEXITED(status))
return (WEXITSTATUS(status));
diff --git a/libexec/getty/main.c b/libexec/getty/main.c
index ea53b153791..3ac0939d8c8 100644
--- a/libexec/getty/main.c
+++ b/libexec/getty/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.53 2019/06/23 18:54:24 rob Exp $ */
+/* $OpenBSD: main.c,v 1.54 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -256,7 +256,7 @@ main(int argc, char *argv[])
}
/* Start with default tty settings */
- if (tcgetattr(0, &tmode) < 0) {
+ if (tcgetattr(0, &tmode) == -1) {
syslog(LOG_ERR, "%s: %m", ttyn);
exit(1);
}
@@ -286,7 +286,7 @@ main(int argc, char *argv[])
cfsetospeed(&tmode, SP);
setflags(0);
setchars();
- if (tcsetattr(0, TCSANOW, &tmode) < 0) {
+ if (tcsetattr(0, TCSANOW, &tmode) == -1) {
syslog(LOG_ERR, "%s: %m", ttyn);
exit(1);
}
@@ -334,7 +334,7 @@ main(int argc, char *argv[])
tmode.c_oflag &= ~OLCUC;
tmode.c_lflag &= ~XCASE;
}
- if (tcsetattr(0, TCSANOW, &tmode) < 0) {
+ if (tcsetattr(0, TCSANOW, &tmode) == -1) {
syslog(LOG_ERR, "%s: %m", ttyn);
exit(1);
}
@@ -376,7 +376,7 @@ getname(void)
sleep(PF);
PF = 0;
}
- if (tcsetattr(0, TCSANOW, &tmode) < 0) {
+ if (tcsetattr(0, TCSANOW, &tmode) == -1) {
syslog(LOG_ERR, "%s: %m", ttyn);
exit(1);
}
diff --git a/libexec/login_radius/raddauth.c b/libexec/login_radius/raddauth.c
index a98a88ca78e..fe92fc12937 100644
--- a/libexec/login_radius/raddauth.c
+++ b/libexec/login_radius/raddauth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raddauth.c,v 1.29 2016/09/03 11:04:23 gsoares Exp $ */
+/* $OpenBSD: raddauth.c,v 1.30 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 Berkeley Software Design, Inc. All rights reserved.
@@ -233,7 +233,7 @@ raddauth(char *username, char *class, char *style, char *challenge,
getsecret();
/* set up socket */
- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
snprintf(_pwstate, sizeof(_pwstate), "%s", strerror(errno));
*emsg = _pwstate;
return (1);
diff --git a/libexec/login_skey/login_skey.c b/libexec/login_skey/login_skey.c
index cd9098fdd51..11a3bae3503 100644
--- a/libexec/login_skey/login_skey.c
+++ b/libexec/login_skey/login_skey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_skey.c,v 1.27 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: login_skey.c,v 1.28 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 2000, 2001, 2004 Todd C. Miller <millert@openbsd.org>
@@ -287,6 +287,6 @@ send_fd(int sock)
*(int *)CMSG_DATA(cmp) = fileno(skey.keyfile);
- if (sendmsg(sock, &msg, 0) < 0)
+ if (sendmsg(sock, &msg, 0) == -1)
syslog(LOG_ERR, "sendmsg: %m");
}
diff --git a/libexec/login_token/login_token.c b/libexec/login_token/login_token.c
index 437d7a95741..0ee7d2cdda4 100644
--- a/libexec/login_token/login_token.c
+++ b/libexec/login_token/login_token.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: login_token.c,v 1.15 2015/12/22 08:54:16 mmcc Exp $ */
+/* $OpenBSD: login_token.c,v 1.16 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1995, 1996 Berkeley Software Design, Inc. All rights reserved.
@@ -78,7 +78,7 @@ main(int argc, char *argv[])
cds.rlim_cur = 0;
cds.rlim_max = 0;
- if (setrlimit(RLIMIT_CORE, &cds) < 0)
+ if (setrlimit(RLIMIT_CORE, &cds) == -1)
syslog(LOG_ERR, "couldn't set core dump size to 0: %m");
if (pledge("stdio rpath wpath cpath fattr flock getpw tty", NULL) == -1) {
diff --git a/libexec/login_token/tokendb.c b/libexec/login_token/tokendb.c
index d52539ef192..e5ccc057273 100644
--- a/libexec/login_token/tokendb.c
+++ b/libexec/login_token/tokendb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tokendb.c,v 1.10 2015/10/05 17:31:17 millert Exp $ */
+/* $OpenBSD: tokendb.c,v 1.11 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1995 Migration Associates Corp. All Rights Reserved
@@ -176,7 +176,7 @@ tokendb_open(void)
return (-1);
}
- if (stat(tt->db, &statb) < 0) {
+ if (stat(tt->db, &statb) == -1) {
if (errno != ENOENT)
return (-1);
must_set_perms++;
diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c
index b823ab0d83b..ddfaae20a0a 100644
--- a/libexec/mail.local/mail.local.c
+++ b/libexec/mail.local/mail.local.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.local.c,v 1.35 2015/12/12 20:09:28 mmcc Exp $ */
+/* $OpenBSD: mail.local.c,v 1.36 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
@@ -201,7 +201,7 @@ retry:
goto bad;
}
if ((mbfd = open(path, O_APPEND|O_CREAT|O_EXCL|O_WRONLY|O_EXLOCK,
- S_IRUSR|S_IWUSR)) < 0) {
+ S_IRUSR|S_IWUSR)) == -1) {
if (errno == EEXIST) {
/* file appeared since lstat */
goto retry;
@@ -216,7 +216,7 @@ retry:
* that if the ownership or permissions were changed there
* was a reason for doing so.
*/
- if (fchown(mbfd, pw->pw_uid, pw->pw_gid) < 0) {
+ if (fchown(mbfd, pw->pw_uid, pw->pw_gid) == -1) {
merr(NOTFATAL, "chown %u:%u: %s",
pw->pw_uid, pw->pw_gid, name);
goto bad;
@@ -227,11 +227,11 @@ retry:
goto bad;
}
if ((mbfd = open(path, O_APPEND|O_WRONLY|O_EXLOCK,
- S_IRUSR|S_IWUSR)) < 0) {
+ S_IRUSR|S_IWUSR)) == -1) {
merr(NOTFATAL, "%s: %s", path, strerror(errno));
goto bad;
}
- if (fstat(mbfd, &fsb)) {
+ if (fstat(mbfd, &fsb) == -1) {
/* relating error to path may be bad style */
merr(NOTFATAL, "%s: %s", path, strerror(errno));
goto bad;
@@ -256,7 +256,7 @@ retry:
while ((nr = read(fd, buf, sizeof(buf))) > 0)
for (off = 0; off < nr; off += nw)
- if ((nw = write(mbfd, buf + off, nr - off)) < 0) {
+ if ((nw = write(mbfd, buf + off, nr - off)) == -1) {
merr(NOTFATAL, "%s: %s", path, strerror(errno));
(void)ftruncate(mbfd, curoff);
goto bad;
diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c
index 12b854eded1..50d1d5b25cd 100644
--- a/libexec/rpc.rquotad/rquotad.c
+++ b/libexec/rpc.rquotad/rquotad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rquotad.c,v 1.22 2015/01/16 06:39:50 deraadt Exp $ */
+/* $OpenBSD: rquotad.c,v 1.23 2019/06/28 13:32:53 deraadt Exp $ */
/*
* by Manuel Bouyer (bouyer@ensta.fr). Public domain.
@@ -67,7 +67,7 @@ main(int argc, char *argv[])
socklen_t fromlen;
fromlen = sizeof(from);
- if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
+ if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) {
from_inetd = 0;
sock = RPC_ANYSOCK;
proto = IPPROTO_UDP;
@@ -231,7 +231,7 @@ getfsquota(long id, char *path, struct dqblk *dqblk)
struct fs_stat *fs;
int qcmd, fd, ret = 0;
- if (stat(path, &st_path) < 0)
+ if (stat(path, &st_path) == -1)
return (0);
qcmd = QCMD(Q_GETQUOTA, USRQUOTA);
@@ -245,7 +245,7 @@ getfsquota(long id, char *path, struct dqblk *dqblk)
if (quotactl(fs->fs_file, qcmd, id, (char *)dqblk) == 0)
return (1);
- if ((fd = open(fs->qfpathname, O_RDONLY)) < 0) {
+ if ((fd = open(fs->qfpathname, O_RDONLY)) == -1) {
syslog(LOG_ERR, "open error: %s: %m", fs->qfpathname);
return (0);
}
diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c
index dc47ba7592d..70e19e387f3 100644
--- a/libexec/rpc.rstatd/rstat_proc.c
+++ b/libexec/rpc.rstatd/rstat_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rstat_proc.c,v 1.35 2017/05/27 07:44:28 tedu Exp $ */
+/* $OpenBSD: rstat_proc.c,v 1.36 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -208,7 +208,7 @@ updatestat(void)
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
len = sizeof(btm);
- if (sysctl(mib, 2, &btm, &len, NULL, 0) < 0) {
+ if (sysctl(mib, 2, &btm, &len, NULL, 0) == -1) {
syslog(LOG_ERR, "can't sysctl kern.boottime: %m");
_exit(1);
}
@@ -225,7 +225,7 @@ updatestat(void)
mib[0] = CTL_VM;
mib[1] = VM_UVMEXP;
len = sizeof(uvmexp);
- if (sysctl(mib, 2, &uvmexp, &len, NULL, 0) < 0) {
+ if (sysctl(mib, 2, &uvmexp, &len, NULL, 0) == -1) {
syslog(LOG_ERR, "can't sysctl vm.uvmexp: %m");
_exit(1);
}
diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c
index 6024f77a286..a0f3811fe35 100644
--- a/libexec/rpc.rstatd/rstatd.c
+++ b/libexec/rpc.rstatd/rstatd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rstatd.c,v 1.29 2015/12/01 20:25:16 tim Exp $ */
+/* $OpenBSD: rstatd.c,v 1.30 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1993, John Brezak
@@ -95,7 +95,7 @@ main(int argc, char *argv[])
* See if inetd started us
*/
fromlen = sizeof(from);
- if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
+ if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) {
from_inetd = 0;
sock = RPC_ANYSOCK;
proto = IPPROTO_UDP;
diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c
index 1f4831d4767..1f3ea756f18 100644
--- a/libexec/rpc.rusersd/rusers_proc.c
+++ b/libexec/rpc.rusersd/rusers_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rusers_proc.c,v 1.26 2017/04/27 21:28:00 millert Exp $ */
+/* $OpenBSD: rusers_proc.c,v 1.27 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@@ -80,7 +80,7 @@ getidle(char *tty, int len)
snprintf(devname, sizeof devname, "%s/%.*s", _PATH_DEV,
len, tty);
- if (stat(devname, &st) < 0) {
+ if (stat(devname, &st) == -1) {
#ifdef DEBUG
printf("%s: %m\n", devname);
#endif
diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c
index 7b9a36fb21d..6b28bb5c581 100644
--- a/libexec/rpc.rusersd/rusersd.c
+++ b/libexec/rpc.rusersd/rusersd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rusersd.c,v 1.20 2018/04/26 12:42:51 guenther Exp $ */
+/* $OpenBSD: rusersd.c,v 1.21 2019/06/28 13:32:53 deraadt Exp $ */
/*-
* Copyright (c) 1993 John Brezak
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
* See if inetd started us
*/
fromlen = sizeof(from);
- if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
+ if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) {
from_inetd = 0;
sock = RPC_ANYSOCK;
proto = IPPROTO_UDP;
diff --git a/libexec/rpc.rwalld/rwalld.c b/libexec/rpc.rwalld/rwalld.c
index 2994ce2a131..fa75ecef126 100644
--- a/libexec/rpc.rwalld/rwalld.c
+++ b/libexec/rpc.rwalld/rwalld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rwalld.c,v 1.16 2017/05/27 07:39:27 tedu Exp $ */
+/* $OpenBSD: rwalld.c,v 1.17 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 1993 Christopher G. Demetriou
@@ -78,7 +78,7 @@ main(int argc, char *argv[])
* See if inetd started us
*/
fromlen = sizeof(from);
- if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
+ if (getsockname(0, (struct sockaddr *)&from, &fromlen) == -1) {
from_inetd = 0;
sock = RPC_ANYSOCK;
proto = IPPROTO_UDP;
diff --git a/libexec/spamd/sync.c b/libexec/spamd/sync.c
index 7b54ae3bbb5..2b1d857aca8 100644
--- a/libexec/spamd/sync.c
+++ b/libexec/spamd/sync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sync.c,v 1.12 2016/10/20 21:09:46 mestre Exp $ */
+/* $OpenBSD: sync.c,v 1.13 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -213,7 +213,7 @@ sync_init(const char *iface, const char *baddr, u_short port)
goto fail;
}
if (setsockopt(syncfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
- sizeof(ttl)) < 0) {
+ sizeof(ttl)) == -1) {
fprintf(stderr, "failed to set multicast ttl to "
"%u: %s\n", ttl, strerror(errno));
setsockopt(syncfd, IPPROTO_IP,
diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c
index 0eaf7aa8652..d081141c6eb 100644
--- a/libexec/spamlogd/spamlogd.c
+++ b/libexec/spamlogd/spamlogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spamlogd.c,v 1.28 2018/10/25 06:41:50 mestre Exp $ */
+/* $OpenBSD: spamlogd.c,v 1.29 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -140,7 +140,7 @@ init_pcap(void)
pcap_freecode(&bpfp);
- if (ioctl(pcap_fileno(hpcap), BIOCLOCK) < 0) {
+ if (ioctl(pcap_fileno(hpcap), BIOCLOCK) == -1) {
logmsg(LOG_ERR, "BIOCLOCK: %s", strerror(errno));
return (-1);
}
diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c
index c5cd96989c7..00bdd0b8c96 100644
--- a/libexec/talkd/announce.c
+++ b/libexec/talkd/announce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: announce.c,v 1.24 2016/02/01 07:25:51 mestre Exp $ */
+/* $OpenBSD: announce.c,v 1.25 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -60,7 +60,7 @@ announce(CTL_MSG *request, char *remote_machine)
return (FAILED);
if ((tf = fopen(full_tty, "w")) == NULL)
return (PERMISSION_DENIED);
- if (fstat(fileno(tf), &stbuf) < 0) {
+ if (fstat(fileno(tf), &stbuf) == -1) {
fclose(tf);
return (PERMISSION_DENIED);
}
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index 7add8370ab8..79fe6dd9b3d 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.c,v 1.25 2016/02/05 10:13:51 mestre Exp $ */
+/* $OpenBSD: talkd.c,v 1.26 2019/06/28 13:32:53 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -67,11 +67,11 @@ main(int argc, char *argv[])
exit(1);
}
openlog("talkd", LOG_PID, LOG_DAEMON);
- if (gethostname(hostname, sizeof(hostname)) < 0) {
+ if (gethostname(hostname, sizeof(hostname)) == -1) {
syslog(LOG_ERR, "gethostname: %m");
_exit(1);
}
- if (chdir(_PATH_DEV) < 0) {
+ if (chdir(_PATH_DEV) == -1) {
syslog(LOG_ERR, "chdir: %s: %m", _PATH_DEV);
_exit(1);
}
@@ -98,7 +98,7 @@ main(int argc, char *argv[])
sizeof(request), 0, (struct sockaddr *)&response.addr,
&len);
if (cc != sizeof(request)) {
- if (cc < 0 && errno != EINTR)
+ if (cc == -1 && errno != EINTR)
syslog(LOG_WARNING, "recvfrom: %m");
continue;
}
diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c
index b9f2723e2f0..497cee7c6e2 100644
--- a/sbin/badsect/badsect.c
+++ b/sbin/badsect/badsect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: badsect.c,v 1.27 2015/11/12 22:33:07 deraadt Exp $ */
+/* $OpenBSD: badsect.c,v 1.28 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: badsect.c,v 1.10 1995/03/18 14:54:28 cgd Exp $ */
/*
@@ -87,7 +87,7 @@ main(int argc, char *argv[])
fprintf(stderr, "usage: badsect bbdir sector ...\n");
exit(1);
}
- if (chdir(argv[1]) < 0 || stat(".", &stbuf) < 0)
+ if (chdir(argv[1]) == -1 || stat(".", &stbuf) == -1)
err(2, "%s", argv[1]);
strlcpy(name, _PATH_DEV, sizeof name);
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
while ((dp = readdir(dirp)) != NULL) {
strlcpy(&name[len], dp->d_name, sizeof name - len);
- if (stat(name, &devstat) < 0)
+ if (stat(name, &devstat) == -1)
err(4, "%s", name);
if (stbuf.st_dev == devstat.st_rdev &&
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
err(5, "Cannot find dev 0%o corresponding to %s",
stbuf.st_rdev, argv[1]);
- if ((fsi = open(name, O_RDONLY)) < 0)
+ if ((fsi = open(name, O_RDONLY)) == -1)
err(6, "%s", name);
fs = &sblock;
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c
index f21dd2f6d57..0353928f1ef 100644
--- a/sbin/bioctl/bioctl.c
+++ b/sbin/bioctl/bioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioctl.c,v 1.142 2019/05/11 20:24:55 krw Exp $ */
+/* $OpenBSD: bioctl.c,v 1.143 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@@ -233,7 +233,7 @@ main(int argc, char *argv[])
memset(&bl, 0, sizeof(bl));
bl.bl_name = devicename;
- if (ioctl(devh, BIOCLOCATE, &bl))
+ if (ioctl(devh, BIOCLOCATE, &bl) == -1)
errx(1, "Can't locate %s device via %s",
bl.bl_name, "/dev/bio");
@@ -397,7 +397,7 @@ bio_inq(char *name)
bi.bi_bio.bio_cookie = bio_cookie;
- if (ioctl(devh, BIOCINQ, &bi)) {
+ if (ioctl(devh, BIOCINQ, &bi) == -1) {
if (errno == ENOTTY)
bio_diskinq(name);
else
@@ -415,7 +415,7 @@ bio_inq(char *name)
bv.bv_percent = -1;
bv.bv_seconds = 0;
- if (ioctl(devh, BIOCVOL, &bv))
+ if (ioctl(devh, BIOCVOL, &bv) == -1)
err(1, "BIOCVOL");
bio_status(&bv.bv_bio.bio_status);
@@ -515,7 +515,7 @@ bio_inq(char *name)
bd.bd_patrol.bdp_percent = -1;
bd.bd_patrol.bdp_seconds = 0;
- if (ioctl(devh, BIOCDISK, &bd))
+ if (ioctl(devh, BIOCDISK, &bd) == -1)
err(1, "BIOCDISK");
bio_status(&bd.bd_bio.bio_status);
@@ -626,7 +626,7 @@ bio_alarm(char *arg)
errx(1, "invalid alarm function: %s", arg);
}
- if (ioctl(devh, BIOCALARM, &ba))
+ if (ioctl(devh, BIOCALARM, &ba) == -1)
err(1, "BIOCALARM");
bio_status(&ba.ba_bio.bio_status);
@@ -645,7 +645,7 @@ bio_getvolbyname(char *name)
memset(&bi, 0, sizeof(bi));
bi.bi_bio.bio_cookie = bio_cookie;
- if (ioctl(devh, BIOCINQ, &bi))
+ if (ioctl(devh, BIOCINQ, &bi) == -1)
err(1, "BIOCINQ");
bio_status(&bi.bi_bio.bio_status);
@@ -654,7 +654,7 @@ bio_getvolbyname(char *name)
memset(&bv, 0, sizeof(bv));
bv.bv_bio.bio_cookie = bio_cookie;
bv.bv_volid = i;
- if (ioctl(devh, BIOCVOL, &bv))
+ if (ioctl(devh, BIOCVOL, &bv) == -1)
err(1, "BIOCVOL");
bio_status(&bv.bv_bio.bio_status);
@@ -701,7 +701,7 @@ bio_setstate(char *arg, int status, char *devicename)
errx(1, "invalid device %s", devicename);
}
- if (ioctl(devh, BIOCSETSTATE, &bs))
+ if (ioctl(devh, BIOCSETSTATE, &bs) == -1)
err(1, "BIOCSETSTATE");
bio_status(&bs.bs_bio.bio_status);
@@ -742,7 +742,7 @@ bio_setblink(char *name, char *arg, int blink)
memset(&bi, 0, sizeof(bi));
bi.bi_bio.bio_cookie = bio_cookie;
- if (ioctl(devh, BIOCINQ, &bi))
+ if (ioctl(devh, BIOCINQ, &bi) == -1)
err(1, "BIOCINQ");
bio_status(&bi.bi_bio.bio_status);
@@ -751,7 +751,7 @@ bio_setblink(char *name, char *arg, int blink)
memset(&bv, 0, sizeof(bv));
bv.bv_bio.bio_cookie = bio_cookie;
bv.bv_volid = v;
- if (ioctl(devh, BIOCVOL, &bv))
+ if (ioctl(devh, BIOCVOL, &bv) == -1)
err(1, "BIOCVOL");
bio_status(&bv.bv_bio.bio_status);
@@ -765,7 +765,7 @@ bio_setblink(char *name, char *arg, int blink)
bd.bd_volid = v;
bd.bd_diskid = d;
- if (ioctl(devh, BIOCDISK, &bd))
+ if (ioctl(devh, BIOCDISK, &bd) == -1)
err(1, "BIOCDISK");
bio_status(&bd.bd_bio.bio_status);
@@ -800,7 +800,7 @@ bio_blink(char *enclosure, int target, int blinktype)
memset(&bl, 0, sizeof(bl));
bl.bl_name = enclosure;
- if (ioctl(bioh, BIOCLOCATE, &bl))
+ if (ioctl(bioh, BIOCLOCATE, &bl) == -1)
errx(1, "Can't locate %s device via %s", enclosure, "/dev/bio");
memset(&blink, 0, sizeof(blink));
@@ -808,7 +808,7 @@ bio_blink(char *enclosure, int target, int blinktype)
blink.bb_status = blinktype;
blink.bb_target = target;
- if (ioctl(bioh, BIOCBLINK, &blink))
+ if (ioctl(bioh, BIOCBLINK, &blink) == -1)
err(1, "BIOCBLINK");
bio_status(&blink.bb_bio.bio_status);
@@ -883,7 +883,7 @@ bio_createraid(u_int16_t level, char *dev_list, char *key_disk)
create.bc_opaque_flags = BIOC_SOOUT;
/* try to get KDF hint */
- if (ioctl(devh, BIOCCREATERAID, &create))
+ if (ioctl(devh, BIOCCREATERAID, &create) == -1)
err(1, "ioctl");
bio_status(&create.bc_bio.bio_status);
@@ -1074,7 +1074,7 @@ bio_deleteraid(char *dev)
bd.bd_bio.bio_cookie = bio_cookie;
/* XXX make this a dev_t instead of a string */
strlcpy(bd.bd_dev, dev, sizeof bd.bd_dev);
- if (ioctl(devh, BIOCDELETERAID, &bd))
+ if (ioctl(devh, BIOCDELETERAID, &bd) == -1)
err(1, "BIOCDELETERAID");
bio_status(&bd.bd_bio.bio_status);
@@ -1100,7 +1100,7 @@ bio_changepass(char *dev)
bd.bd_size = sizeof(kdfhint);
bd.bd_data = &kdfhint;
- if (ioctl(devh, BIOCDISCIPLINE, &bd))
+ if (ioctl(devh, BIOCDISCIPLINE, &bd) == -1)
err(1, "BIOCDISCIPLINE");
bio_status(&bd.bd_bio.bio_status);
@@ -1133,7 +1133,7 @@ bio_changepass(char *dev)
explicit_bzero(&kdfinfo1, sizeof(kdfinfo1));
explicit_bzero(&kdfinfo2, sizeof(kdfinfo2));
- if (rv)
+ if (rv == -1)
err(1, "BIOCDISCIPLINE");
bio_status(&bd.bd_bio.bio_status);
@@ -1217,7 +1217,7 @@ bio_patrol(char *arg)
break;
}
- if (ioctl(devh, BIOCPATROL, &bp))
+ if (ioctl(devh, BIOCPATROL, &bp) == -1)
err(1, "BIOCPATROL");
bio_status(&bp.bp_bio.bio_status);
diff --git a/sbin/clri/clri.c b/sbin/clri/clri.c
index 972796a19a6..60f58cfaf6b 100644
--- a/sbin/clri/clri.c
+++ b/sbin/clri/clri.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clri.c,v 1.19 2016/03/07 21:47:04 natano Exp $ */
+/* $OpenBSD: clri.c,v 1.20 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: clri.c,v 1.19 2005/01/20 15:50:47 xtraeme Exp $ */
/*
@@ -77,7 +77,7 @@ main(int argc, char *argv[])
sbp = NULL;
/* get the superblock. */
- if ((fd = opendev(fs, O_RDWR, 0, NULL)) < 0)
+ if ((fd = opendev(fs, O_RDWR, 0, NULL)) == -1)
err(1, "%s", fs);
if (pledge("stdio", NULL) == -1)
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index c7df8d40cea..2d05eb7bfa3 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.635 2019/05/22 12:56:31 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.636 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -1856,7 +1856,7 @@ write_option_db(char *name, struct client_lease *offered,
else if (fprintf(optionDB, "%s", leasestr) == -1)
log_warn("optionDB 'effective' fprintf()");
- if (fflush(optionDB) == -1)
+ if (fflush(optionDB) == EOF)
log_warn("optionDB fflush()");
else if (fsync(fileno(optionDB)) == -1)
log_warn("optionDB fsync()");
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index 3307f54478c..45d7e6c944a 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.234 2019/04/02 01:47:49 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.235 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -203,7 +203,7 @@ main(int argc, char *argv[])
dkname = argv[0];
f = opendev(dkname, (op == READ ? O_RDONLY : O_RDWR), OPENDEV_PART,
&specname);
- if (f < 0)
+ if (f == -1)
err(4, "%s", specname);
if (op != WRITE || aflag || dflag) {
diff --git a/sbin/dump/dumprmt.c b/sbin/dump/dumprmt.c
index 108bd9ae4d0..9cf7b6e09a0 100644
--- a/sbin/dump/dumprmt.c
+++ b/sbin/dump/dumprmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dumprmt.c,v 1.29 2015/01/16 06:39:57 deraadt Exp $ */
+/* $OpenBSD: dumprmt.c,v 1.30 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $ */
/*-
@@ -148,7 +148,7 @@ rmtgetconn(void)
/* Leave some space for rmt request/response protocol */
size += 2 * 1024;
while (size > TP_BSIZE &&
- setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0)
+ setsockopt(rmtape, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) == -1)
size -= TP_BSIZE;
(void)setsockopt(rmtape, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c
index ac60ea907d0..4ab4bfe3406 100644
--- a/sbin/dump/itime.c
+++ b/sbin/dump/itime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: itime.c,v 1.23 2015/12/22 21:03:58 mmcc Exp $ */
+/* $OpenBSD: itime.c,v 1.24 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $ */
/*-
@@ -172,7 +172,7 @@ putdumptime(void)
dthead = NULL;
ddates_in = 0;
readdumptimes(df);
- if (fseek(df, 0L, SEEK_SET) < 0)
+ if (fseek(df, 0L, SEEK_SET) == -1)
quit("fseek: %s\n", strerror(errno));
spcl.c_ddate = 0;
ITITERATE(i, dtwalk) {
diff --git a/sbin/dump/main.c b/sbin/dump/main.c
index d5c85898819..93d74728782 100644
--- a/sbin/dump/main.c
+++ b/sbin/dump/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.60 2018/04/26 17:40:48 guenther Exp $ */
+/* $OpenBSD: main.c,v 1.61 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/*-
@@ -382,11 +382,11 @@ main(int argc, char *argv[])
spcl.c_level = level - '0';
spcl.c_type = TS_TAPE;
- if ((diskfd = open(disk, O_RDONLY)) < 0) {
+ if ((diskfd = open(disk, O_RDONLY)) == -1) {
msg("Cannot open %s\n", disk);
exit(X_STARTUP);
}
- if (ioctl(diskfd, DIOCGDINFO, (char *)&lab) < 0)
+ if (ioctl(diskfd, DIOCGDINFO, (char *)&lab) == -1)
err(1, "ioctl (DIOCGDINFO)");
if (memcmp(lab.d_uid, &zero_uid, sizeof(lab.d_uid)) != 0) {
@@ -416,7 +416,7 @@ main(int argc, char *argv[])
else
msgtail("to %s\n", tape);
- if (ioctl(diskfd, DIOCGPDINFO, (char *)&lab) < 0)
+ if (ioctl(diskfd, DIOCGPDINFO, (char *)&lab) == -1)
err(1, "ioctl (DIOCGPDINFO)");
sync();
sblock = (struct fs *)sblock_buf;
@@ -658,7 +658,7 @@ getduid(char *path)
char *duid;
if ((fd = opendev(path, O_RDONLY | O_NOFOLLOW, 0, NULL)) >= 0) {
- if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) {
close(fd);
warn("ioctl(DIOCGDINFO)");
return (NULL);
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c
index 445a75df555..c0cc1b6021d 100644
--- a/sbin/dump/tape.c
+++ b/sbin/dump/tape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tape.c,v 1.44 2017/12/08 17:04:15 deraadt Exp $ */
+/* $OpenBSD: tape.c,v 1.45 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/*-
@@ -416,7 +416,7 @@ trewind(void)
}
(void) close(tapefd);
- while ((f = open(tape, O_RDONLY)) < 0)
+ while ((f = open(tape, O_RDONLY)) == -1)
sleep (10);
(void) close(f);
}
@@ -577,7 +577,7 @@ restore_check_point:
* All signals are inherited...
*/
childpid = fork();
- if (childpid < 0) {
+ if (childpid == -1) {
msg("Context save fork fails in parent %d\n", parentpid);
Exit(X_ABORT);
}
@@ -656,10 +656,10 @@ restore_check_point:
}
#ifdef RDUMP
while ((tapefd = (host ? rmtopen(tape, O_WRONLY|O_CREAT) :
- pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
+ pipeout ? 1 : open(tape, O_WRONLY|O_CREAT, 0666))) == -1)
#else
while ((tapefd = (pipeout ? 1 :
- open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
+ open(tape, O_WRONLY|O_CREAT, 0666))) == -1)
#endif
{
msg("Cannot open output \"%s\".\n", tape);
@@ -751,8 +751,8 @@ enslave(void)
caught = 0;
}
- if (socketpair(AF_UNIX, SOCK_STREAM, 0, cmd) < 0 ||
- (slaves[i].pid = fork()) < 0)
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, cmd) == -1 ||
+ (slaves[i].pid = fork()) == -1)
quit("too many slaves, %d (recompile smaller): %s\n",
i, strerror(errno));
@@ -804,7 +804,7 @@ doslave(int cmd, int slave_number)
* Need our own seek pointer.
*/
(void) close(diskfd);
- if ((diskfd = open(disk, O_RDONLY)) < 0)
+ if ((diskfd = open(disk, O_RDONLY)) == -1)
quit("slave couldn't reopen disk: %s\n", strerror(errno));
/*
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c
index 8f16d2c99fd..908092560e0 100644
--- a/sbin/dumpfs/dumpfs.c
+++ b/sbin/dumpfs/dumpfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dumpfs.c,v 1.33 2015/11/23 19:19:29 deraadt Exp $ */
+/* $OpenBSD: dumpfs.c,v 1.34 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -128,7 +128,7 @@ open_disk(const char *name)
ssize_t n;
/* XXX - should retry w/raw device on failure */
- if ((fd = opendev(name, O_RDONLY, 0, NULL)) < 0) {
+ if ((fd = opendev(name, O_RDONLY, 0, NULL)) == -1) {
warn("%s", name);
return(-1);
}
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 7b6132032f4..09475f346d3 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.c,v 1.39 2018/09/24 21:26:00 deraadt Exp $ */
+/* $OpenBSD: fsck.c,v 1.40 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */
/*
@@ -102,7 +102,7 @@ main(int argc, char *argv[])
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
else
rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
warn("Can't set resource limit to max data size");
} else
warn("Can't get resource limit for data size");
@@ -339,7 +339,7 @@ checkfs(const char *vfstype, const char *spec, const char *mntpt, void *auxarg,
return 0;
}
- if (waitpid(pid, &status, 0) < 0) {
+ if (waitpid(pid, &status, 0) == -1) {
warn("waitpid");
return (1);
}
diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c
index f0b88684058..6d4e96f93d1 100644
--- a/sbin/fsck/fsutil.c
+++ b/sbin/fsck/fsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsutil.c,v 1.23 2018/09/24 21:26:00 deraadt Exp $ */
+/* $OpenBSD: fsutil.c,v 1.24 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $ */
/*
@@ -58,7 +58,7 @@ struct stat stslash;
void
checkroot(void)
{
- if (stat("/", &stslash) < 0) {
+ if (stat("/", &stslash) == -1) {
xperror("/");
printf("Can't stat root\n");
}
@@ -164,7 +164,7 @@ unrawname(char *name)
if ((dp = strrchr(name, '/')) == NULL)
return (name);
- if (stat(name, &stb) < 0)
+ if (stat(name, &stb) == -1)
return (name);
if (!S_ISCHR(stb.st_mode))
return (name);
@@ -201,14 +201,14 @@ blockcheck(char *origname)
hot = 0;
newname = origname;
retry:
- if (stat(newname, &stblock) < 0)
+ if (stat(newname, &stblock) == -1)
return (origname);
if (S_ISBLK(stblock.st_mode)) {
if (stslash.st_dev == stblock.st_rdev)
hot++;
raw = rawname(newname);
- if (stat(raw, &stchar) < 0) {
+ if (stat(raw, &stchar) == -1) {
xperror(raw);
printf("Can't stat %s\n", raw);
return (origname);
diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c
index 785e488dd4c..716aa76edc9 100644
--- a/sbin/fsck_ext2fs/setup.c
+++ b/sbin/fsck_ext2fs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.31 2017/08/26 06:32:06 otto Exp $ */
+/* $OpenBSD: setup.c,v 1.32 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
@@ -76,7 +76,7 @@ setup(char *dev)
havesb = 0;
fswritefd = -1;
doskipclean = skipclean;
- if (stat(dev, &statb) < 0) {
+ if (stat(dev, &statb) == -1) {
printf("Can't stat %s: %s\n", dev, strerror(errno));
return (0);
}
@@ -85,13 +85,13 @@ setup(char *dev)
if (reply("CONTINUE") == 0)
return (0);
}
- if ((fsreadfd = open(dev, O_RDONLY)) < 0) {
+ if ((fsreadfd = open(dev, O_RDONLY)) == -1) {
printf("Can't open %s: %s\n", dev, strerror(errno));
return (0);
}
if (preen == 0)
printf("** %s", dev);
- if (nflag || (fswritefd = open(dev, O_WRONLY)) < 0) {
+ if (nflag || (fswritefd = open(dev, O_WRONLY)) == -1) {
fswritefd = -1;
if (preen)
pfatal("NO WRITE ACCESS");
@@ -487,7 +487,7 @@ getdisklabel(char *s, int fd)
{
static struct disklabel lab;
- if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) {
if (s == NULL)
return (NULL);
pwarn("ioctl (GCINFO): %s\n", strerror(errno));
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 0d2a9dcf574..d8a97c63ecf 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.65 2018/09/24 21:26:02 deraadt Exp $ */
+/* $OpenBSD: setup.c,v 1.66 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -93,7 +93,7 @@ setup(char *dev, int isfsdb)
havesb = 0;
fswritefd = fsreadfd = -1;
doskipclean = skipclean;
- if ((fsreadfd = opendev(dev, O_RDONLY, 0, &realdev)) < 0) {
+ if ((fsreadfd = opendev(dev, O_RDONLY, 0, &realdev)) == -1) {
printf("Can't open %s: %s\n", dev, strerror(errno));
return (0);
}
@@ -111,7 +111,7 @@ setup(char *dev, int isfsdb)
}
}
- if (fstat(fsreadfd, &statb) < 0) {
+ if (fstat(fsreadfd, &statb) == -1) {
printf("Can't stat %s: %s\n", realdev, strerror(errno));
close(fsreadfd);
return (0);
@@ -128,7 +128,7 @@ setup(char *dev, int isfsdb)
if (strncmp(dev, realdev, PATH_MAX) != 0)
printf(" (%s)", dev);
}
- if (nflag || (fswritefd = opendev(dev, O_WRONLY, 0, NULL)) < 0) {
+ if (nflag || (fswritefd = opendev(dev, O_WRONLY, 0, NULL)) == -1) {
fswritefd = -1;
if (preen)
pfatal("NO WRITE ACCESS");
@@ -662,7 +662,7 @@ getdisklabel(char *s, int fd)
{
static struct disklabel lab;
- if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) {
if (s == NULL)
return (NULL);
pwarn("ioctl (GCINFO): %s\n", strerror(errno));
diff --git a/sbin/fsck_msdos/check.c b/sbin/fsck_msdos/check.c
index a5d972d49f0..4a2f07f1131 100644
--- a/sbin/fsck_msdos/check.c
+++ b/sbin/fsck_msdos/check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check.c,v 1.19 2018/09/24 21:26:02 deraadt Exp $ */
+/* $OpenBSD: check.c,v 1.20 2019/06/28 13:32:43 deraadt Exp $ */
/* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */
/*
@@ -60,11 +60,11 @@ checkfilesys(const char *fname)
rdonly = alwaysno;
dosfs = opendev(fname, rdonly ? O_RDONLY : O_RDWR, 0, &realdev);
- if (dosfs < 0 && !rdonly) {
+ if (dosfs == -1 && !rdonly) {
dosfs = opendev(fname, O_RDONLY, 0, &realdev);
rdonly = 1;
}
- if (dosfs < 0) {
+ if (dosfs == -1) {
xperror("Can't open");
return (8);
}
@@ -78,7 +78,7 @@ checkfilesys(const char *fname)
printf("\n");
}
- if (ioctl(dosfs, DIOCGDINFO, (char *)&lab) < 0)
+ if (ioctl(dosfs, DIOCGDINFO, (char *)&lab) == -1)
pfatal("can't read disk label for %s\n", fname);
if (pledge("stdio", NULL) == -1)
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 10df61497c0..8f2d15a9e7d 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsirand.c,v 1.40 2019/01/25 00:19:26 millert Exp $ */
+/* $OpenBSD: fsirand.c,v 1.41 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <millert@openbsd.org>
@@ -74,7 +74,7 @@ main(int argc, char *argv[])
/* Increase our data size to the max */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
warn("Can't set resource limit to max data size");
} else
warn("Can't get resource limit for data size");
@@ -107,14 +107,14 @@ fsirand(char *device)
struct disklabel label;
if ((devfd = opendev(device, printonly ? O_RDONLY : O_RDWR,
- 0, &devpath)) < 0) {
+ 0, &devpath)) == -1) {
warn("Can't open %s", devpath);
return (1);
}
/* Get block size (usually 512) from disklabel if possible */
if (!ignorelabel) {
- if (ioctl(devfd, DIOCGDINFO, &label) < 0)
+ if (ioctl(devfd, DIOCGDINFO, &label) == -1)
warn("Can't read disklabel, using sector size of %d",
bsize);
else
@@ -180,7 +180,7 @@ fsirand(char *device)
tmpsblock = (struct fs *)&sbuftmp;
for (cg = 0; cg < sblock->fs_ncg; cg++) {
dblk = fsbtodb(sblock, cgsblock(sblock, cg));
- if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
+ if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) == -1) {
warn("Can't seek to %lld", (long long)dblk * bsize);
return (1);
} else if ((n = read(devfd, tmpsblock, SBSIZE)) != SBSIZE) {
@@ -247,7 +247,7 @@ fsirand(char *device)
if ((sblock->fs_inodefmt >= FS_44INODEFMT) && !printonly) {
dblk = fsbtodb(sblock, cgsblock(sblock, cg));
if (lseek(devfd, (off_t)dblk * bsize,
- SEEK_SET) < 0) {
+ SEEK_SET) == -1) {
warn("Can't seek to %lld",
(long long)dblk * bsize);
return (1);
@@ -262,7 +262,7 @@ fsirand(char *device)
/* Read in inodes, then print or randomize generation nums */
dblk = fsbtodb(sblock, ino_to_fsba(sblock, inumber));
- if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
+ if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) == -1) {
warn("Can't seek to %lld", (long long)dblk * bsize);
return (1);
} else if ((n = read(devfd, inodebuf, ibufsize)) != ibufsize) {
@@ -291,7 +291,7 @@ fsirand(char *device)
/* Write out modified inodes */
if (!printonly) {
- if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) {
+ if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) == -1) {
warn("Can't seek to %lld",
(long long)dblk * bsize);
return (1);
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index cbbd4c29e7c..9a91ebabd73 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.51 2016/05/28 20:40:23 tb Exp $ */
+/* $OpenBSD: growfs.c,v 1.52 2019/06/28 13:32:43 deraadt Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -1386,7 +1386,7 @@ rdfs(daddr_t bno, size_t size, void *bf, int fsi)
if (bno < 0) {
err(32, "rdfs: attempting to read negative block number");
}
- if (lseek(fsi, (off_t)bno * DEV_BSIZE, SEEK_SET) < 0) {
+ if (lseek(fsi, (off_t)bno * DEV_BSIZE, SEEK_SET) == -1) {
err(33, "rdfs: seek error: %jd", (intmax_t)bno);
}
n = read(fsi, bf, size);
@@ -1406,7 +1406,7 @@ wtfs(daddr_t bno, size_t size, void *bf, int fso, unsigned int Nflag)
if (Nflag)
return;
- if (lseek(fso, (off_t)bno * DEV_BSIZE, SEEK_SET) < 0)
+ if (lseek(fso, (off_t)bno * DEV_BSIZE, SEEK_SET) == -1)
err(35, "wtfs: seek error: %ld", (long)bno);
n = write(fso, bf, size);
if (n != (ssize_t)size)
@@ -1753,7 +1753,7 @@ main(int argc, char **argv)
* Rather than guessing, use opendev() to get the device
* name, which we open for reading.
*/
- if ((fsi = opendev(*argv, O_RDONLY, 0, &device)) < 0)
+ if ((fsi = opendev(*argv, O_RDONLY, 0, &device)) == -1)
err(1, "%s", *argv);
/*
@@ -1763,7 +1763,7 @@ main(int argc, char **argv)
fso = -1;
} else {
fso = open(device, O_WRONLY);
- if (fso < 0)
+ if (fso == -1)
err(1, "%s", device);
}
@@ -1771,7 +1771,7 @@ main(int argc, char **argv)
* Now we have a file descriptor for our device, fstat() it to
* figure out the partition number.
*/
- if (fstat(fsi, &st) != 0)
+ if (fstat(fsi, &st) == -1)
err(1, "%s: fstat()", device);
/*
@@ -1979,7 +1979,7 @@ return_disklabel(int fd, struct disklabel *lp, unsigned int Nflag)
sum ^= *ptr++;
lp->d_checksum = sum;
- if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0)
+ if (ioctl(fd, DIOCWDINFO, (char *)lp) == -1)
errx(1, "DIOCWDINFO failed");
}
free(lp);
diff --git a/sbin/ifconfig/brconfig.c b/sbin/ifconfig/brconfig.c
index 53bbcd3e241..9cf97841f65 100644
--- a/sbin/ifconfig/brconfig.c
+++ b/sbin/ifconfig/brconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brconfig.c,v 1.21 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: brconfig.c,v 1.22 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -202,7 +202,7 @@ addlocal(const char *ifsname, int d)
/* Add local */
strlcpy(breq.ifbr_name, name, sizeof(breq.ifbr_name));
strlcpy(breq.ifbr_ifsname, ifsname, sizeof(breq.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGADDL, (caddr_t)&breq) < 0) {
+ if (ioctl(s, SIOCBRDGADDL, (caddr_t)&breq) == -1) {
if (errno == EEXIST)
return;
else
@@ -217,12 +217,12 @@ bridge_ifsetflag(const char *ifsname, u_int32_t flag)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0)
+ if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) == -1)
err(1, "%s: ioctl SIOCBRDGGIFFLGS %s", name, ifsname);
req.ifbr_ifsflags |= flag & ~IFBIF_RO_MASK;
- if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0)
+ if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) == -1)
err(1, "%s: ioctl SIOCBRDGSIFFLGS %s", name, ifsname);
}
@@ -234,12 +234,12 @@ bridge_ifclrflag(const char *ifsname, u_int32_t flag)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifsname, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) < 0)
+ if (ioctl(s, SIOCBRDGGIFFLGS, (caddr_t)&req) == -1)
err(1, "%s: ioctl SIOCBRDGGIFFLGS %s", name, ifsname);
req.ifbr_ifsflags &= ~(flag | IFBIF_RO_MASK);
- if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) < 0)
+ if (ioctl(s, SIOCBRDGSIFFLGS, (caddr_t)&req) == -1)
err(1, "%s: ioctl SIOCBRDGSIFFLGS %s", name, ifsname);
}
@@ -250,7 +250,7 @@ bridge_flushall(const char *val, int p)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
req.ifbr_ifsflags = IFBF_FLUSHALL;
- if (ioctl(s, SIOCBRDGFLUSH, &req) < 0)
+ if (ioctl(s, SIOCBRDGFLUSH, &req) == -1)
err(1, "%s", name);
}
@@ -261,7 +261,7 @@ bridge_flush(const char *val, int p)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
req.ifbr_ifsflags = IFBF_FLUSHDYN;
- if (ioctl(s, SIOCBRDGFLUSH, &req) < 0)
+ if (ioctl(s, SIOCBRDGFLUSH, &req) == -1)
err(1, "%s", name);
}
@@ -323,7 +323,7 @@ bridge_list(char *delim)
err(1, "malloc");
bifc.ifbic_buf = inbuf = inb;
strlcpy(bifc.ifbic_name, name, sizeof(bifc.ifbic_name));
- if (ioctl(s, SIOCBRDGIFS, &bifc) < 0) {
+ if (ioctl(s, SIOCBRDGIFS, &bifc) == -1) {
if (errno == ENOTTY)
return;
err(1, "%s SIOCBRDGIFS", name);
@@ -371,7 +371,7 @@ bridge_add(const char *ifn, int d)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGADD, &req) < 0) {
+ if (ioctl(s, SIOCBRDGADD, &req) == -1) {
if (errno == EEXIST)
return;
err(1, "%s: %s", name, ifn);
@@ -385,7 +385,7 @@ bridge_delete(const char *ifn, int d)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGDEL, &req) < 0)
+ if (ioctl(s, SIOCBRDGDEL, &req) == -1)
err(1, "%s: %s", name, ifn);
}
@@ -396,7 +396,7 @@ bridge_addspan(const char *ifn, int d)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGADDS, &req) < 0) {
+ if (ioctl(s, SIOCBRDGADDS, &req) == -1) {
if (errno == EEXIST)
return;
err(1, "%s: %s", name, ifn);
@@ -410,7 +410,7 @@ bridge_delspan(const char *ifn, int d)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifn, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGDELS, &req) < 0)
+ if (ioctl(s, SIOCBRDGDELS, &req) == -1)
err(1, "%s: %s", name, ifn);
}
@@ -430,7 +430,7 @@ bridge_timeout(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_ctime = newtime;
- if (ioctl(s, SIOCBRDGSTO, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSTO, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -449,7 +449,7 @@ bridge_maxage(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_maxage = v;
- if (ioctl(s, SIOCBRDGSMA, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSMA, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -468,7 +468,7 @@ bridge_priority(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_prio = v;
- if (ioctl(s, SIOCBRDGSPRI, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSPRI, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -500,7 +500,7 @@ bridge_protect(const char *ifname, const char *val)
str = strtok(NULL, ",");
}
- if (ioctl(s, SIOCBRDGSIFPROT, (caddr_t)&breq) < 0)
+ if (ioctl(s, SIOCBRDGSIFPROT, (caddr_t)&breq) == -1)
err(1, "%s: %s", name, val);
free(optlist);
@@ -516,7 +516,7 @@ bridge_unprotect(const char *ifname, int d)
breq.ifbr_protected = 0;
- if (ioctl(s, SIOCBRDGSIFPROT, (caddr_t)&breq) < 0)
+ if (ioctl(s, SIOCBRDGSIFPROT, (caddr_t)&breq) == -1)
err(1, "%s: %d", name, 0);
}
@@ -536,7 +536,7 @@ bridge_proto(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_prio = proto;
- if (ioctl(s, SIOCBRDGSPROTO, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSPROTO, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -555,7 +555,7 @@ bridge_fwddelay(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_fwddelay = v;
- if (ioctl(s, SIOCBRDGSFD, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSFD, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -574,7 +574,7 @@ bridge_hellotime(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_hellotime = v;
- if (ioctl(s, SIOCBRDGSHT, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSHT, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -593,7 +593,7 @@ bridge_maxaddr(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_csize = newsize;
- if (ioctl(s, SIOCBRDGSCACHE, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSCACHE, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -610,7 +610,7 @@ bridge_deladdr(const char *addr, int d)
bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr));
- if (ioctl(s, SIOCBRDGDADDR, &ifba) < 0)
+ if (ioctl(s, SIOCBRDGDADDR, &ifba) == -1)
err(1, "%s: %s", name, addr);
}
@@ -631,7 +631,7 @@ bridge_ifprio(const char *ifname, const char *val)
err(1, "invalid arg for ifpriority: %s", val);
breq.ifbr_priority = v;
- if (ioctl(s, SIOCBRDGSIFPRIO, (caddr_t)&breq) < 0)
+ if (ioctl(s, SIOCBRDGSIFPRIO, (caddr_t)&breq) == -1)
err(1, "%s: %s", name, val);
}
@@ -653,7 +653,7 @@ bridge_ifcost(const char *ifname, const char *val)
breq.ifbr_path_cost = v;
- if (ioctl(s, SIOCBRDGSIFCOST, (caddr_t)&breq) < 0)
+ if (ioctl(s, SIOCBRDGSIFCOST, (caddr_t)&breq) == -1)
err(1, "%s: %s", name, val);
}
@@ -667,7 +667,7 @@ bridge_noifcost(const char *ifname, int d)
breq.ifbr_path_cost = 0;
- if (ioctl(s, SIOCBRDGSIFCOST, (caddr_t)&breq) < 0)
+ if (ioctl(s, SIOCBRDGSIFCOST, (caddr_t)&breq) == -1)
err(1, "%s", name);
}
@@ -687,7 +687,7 @@ bridge_addaddr(const char *ifname, const char *addr)
bcopy(ea, &ifba.ifba_dst, sizeof(struct ether_addr));
ifba.ifba_flags = IFBAF_STATIC;
- if (ioctl(s, SIOCBRDGSADDR, &ifba) < 0)
+ if (ioctl(s, SIOCBRDGSADDR, &ifba) == -1)
err(1, "%s: %s", name, addr);
}
@@ -714,7 +714,7 @@ bridge_addrs(const char *delim, int d)
err(1, "malloc");
ifbac.ifbac_buf = inbuf = inb;
strlcpy(ifbac.ifbac_name, name, sizeof(ifbac.ifbac_name));
- if (ioctl(s, SIOCBRDGRTS, &ifbac) < 0) {
+ if (ioctl(s, SIOCBRDGRTS, &ifbac) == -1) {
if (errno == ENETDOWN)
return;
err(1, "%s", name);
@@ -752,7 +752,7 @@ bridge_holdcnt(const char *value, int d)
err(1, "holdcnt %s %s", value, errstr);
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
- if (ioctl(s, SIOCBRDGSTXHC, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCBRDGSTXHC, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -767,12 +767,12 @@ is_bridge(char *brdg)
strlcpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) == -1)
return (0);
ifbac.ifbac_len = 0;
strlcpy(ifbac.ifbac_name, brdg, sizeof(ifbac.ifbac_name));
- if (ioctl(s, SIOCBRDGRTS, (caddr_t)&ifbac) < 0) {
+ if (ioctl(s, SIOCBRDGRTS, (caddr_t)&ifbac) == -1) {
if (errno == ENETDOWN)
return (1);
return (0);
@@ -790,7 +790,7 @@ bridge_status(void)
return;
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) == -1)
return;
bridge_cfg("\t");
@@ -801,11 +801,11 @@ bridge_status(void)
return;
strlcpy(bp1.ifbrp_name, name, sizeof(bp1.ifbrp_name));
- if (ioctl(s, SIOCBRDGGCACHE, (caddr_t)&bp1) < 0)
+ if (ioctl(s, SIOCBRDGGCACHE, (caddr_t)&bp1) == -1)
return;
strlcpy(bp2.ifbrp_name, name, sizeof(bp2.ifbrp_name));
- if (ioctl(s, SIOCBRDGGTO, (caddr_t)&bp2) < 0)
+ if (ioctl(s, SIOCBRDGGTO, (caddr_t)&bp2) == -1)
return;
printf("\tAddresses (max cache: %u, timeout: %u):\n",
@@ -821,7 +821,7 @@ bridge_flushrule(const char *ifname, int d)
strlcpy(req.ifbr_name, name, sizeof(req.ifbr_name));
strlcpy(req.ifbr_ifsname, ifname, sizeof(req.ifbr_ifsname));
- if (ioctl(s, SIOCBRDGFRL, &req) < 0)
+ if (ioctl(s, SIOCBRDGFRL, &req) == -1)
err(1, "%s: %s", name, ifname);
}
@@ -841,7 +841,7 @@ bridge_rules(const char *ifname, int usetab)
ifc.ifbrl_buf = inbuf = inb;
strlcpy(ifc.ifbrl_name, name, sizeof(ifc.ifbrl_name));
strlcpy(ifc.ifbrl_ifsname, ifname, sizeof(ifc.ifbrl_ifsname));
- if (ioctl(s, SIOCBRDGGRL, &ifc) < 0)
+ if (ioctl(s, SIOCBRDGGRL, &ifc) == -1)
err(1, "ioctl(SIOCBRDGGRL)");
if (ifc.ifbrl_len + sizeof(*ifrp) < len)
break;
@@ -1020,7 +1020,7 @@ bridge_rule(int targc, char **targv, int ln)
}
}
- if (ioctl(s, SIOCBRDGARL, &rule) < 0) {
+ if (ioctl(s, SIOCBRDGARL, &rule) == -1) {
warn("%s", name);
return (1);
}
@@ -1151,7 +1151,7 @@ is_switch(char *swname)
struct ifbrparam bp;
strlcpy(bp.ifbrp_name, swname, sizeof(bp.ifbrp_name));
- if (ioctl(s, SIOCSWGDPID, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCSWGDPID, (caddr_t)&bp) == -1)
return (0);
return (1);
@@ -1163,19 +1163,19 @@ switch_cfg(char *delim)
struct ifbrparam bp;
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
- if (ioctl(s, SIOCSWGDPID, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCSWGDPID, (caddr_t)&bp) == -1)
err(1, "%s", name);
printf("%sdatapath %#016llx", delim, bp.ifbrp_datapath);
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
- if (ioctl(s, SIOCSWGMAXFLOW, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCSWGMAXFLOW, (caddr_t)&bp) == -1)
err(1, "%s", name);
printf(" maxflow %d", bp.ifbrp_maxflow);
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
- if (ioctl(s, SIOCSWGMAXGROUP, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCSWGMAXGROUP, (caddr_t)&bp) == -1)
err(1, "%s", name);
printf(" maxgroup %d\n", bp.ifbrp_maxgroup);
@@ -1190,7 +1190,7 @@ switch_status(void)
return;
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) == -1)
return;
switch_cfg("\t");
@@ -1215,7 +1215,7 @@ switch_datapathid(const char *arg, int d)
strlcpy(bp.ifbrp_name, name, sizeof(bp.ifbrp_name));
bp.ifbrp_datapath = newdpid;
- if (ioctl(s, SIOCSWSDPID, (caddr_t)&bp) < 0)
+ if (ioctl(s, SIOCSWSDPID, (caddr_t)&bp) == -1)
err(1, "%s", name);
}
@@ -1235,7 +1235,7 @@ switch_portno(const char *ifname, const char *val)
errx(1, "invalid arg for portidx: %s", val);
breq.ifbr_portno = newportidx;
- if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) < 0) {
+ if (ioctl(s, SIOCSWSPORTNO, (caddr_t)&breq) == -1) {
if (errno == EEXIST)
return;
else
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 6189461ea49..80e123341cc 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.402 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.403 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -923,7 +923,7 @@ nextarg:
if (clearaddr) {
(void) strlcpy(rafp->af_ridreq, name, sizeof(ifr.ifr_name));
- if (ioctl(s, rafp->af_difaddr, rafp->af_ridreq) < 0) {
+ if (ioctl(s, rafp->af_difaddr, rafp->af_ridreq) == -1) {
if (errno == EADDRNOTAVAIL && (doalias >= 0)) {
/* means no previous address for interface */
} else
@@ -932,7 +932,7 @@ nextarg:
}
if (newaddr) {
(void) strlcpy(rafp->af_addreq, name, sizeof(ifr.ifr_name));
- if (ioctl(s, rafp->af_aifaddr, rafp->af_addreq) < 0)
+ if (ioctl(s, rafp->af_aifaddr, rafp->af_addreq) == -1)
err(1, "SIOCAIFADDR");
}
return (0);
@@ -948,7 +948,7 @@ getsock(int naf)
if (oaf != -1)
close(s);
s = socket(naf, SOCK_DGRAM, 0);
- if (s < 0)
+ if (s == -1)
oaf = -1;
else
oaf = naf;
@@ -959,45 +959,45 @@ getinfo(struct ifreq *ifr, int create)
{
getsock(af);
- if (s < 0)
+ if (s == -1)
err(1, "socket");
if (!isdigit((unsigned char)name[strlen(name) - 1]))
return (-1); /* ignore groups here */
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)ifr) < 0) {
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)ifr) == -1) {
int oerrno = errno;
if (!create)
return (-1);
- if (ioctl(s, SIOCIFCREATE, (caddr_t)ifr) < 0) {
+ if (ioctl(s, SIOCIFCREATE, (caddr_t)ifr) == -1) {
errno = oerrno;
return (-1);
}
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)ifr) == -1)
return (-1);
}
flags = ifr->ifr_flags & 0xffff;
- if (ioctl(s, SIOCGIFXFLAGS, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFXFLAGS, (caddr_t)ifr) == -1)
ifr->ifr_flags = 0;
xflags = ifr->ifr_flags;
- if (ioctl(s, SIOCGIFMETRIC, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFMETRIC, (caddr_t)ifr) == -1)
metric = 0;
else
metric = ifr->ifr_metric;
#ifdef SMALL
- if (ioctl(s, SIOCGIFMTU, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFMTU, (caddr_t)ifr) == -1)
#else
- if (is_bridge(name) || ioctl(s, SIOCGIFMTU, (caddr_t)ifr) < 0)
+ if (is_bridge(name) || ioctl(s, SIOCGIFMTU, (caddr_t)ifr) == -1)
#endif
mtu = 0;
else
mtu = ifr->ifr_mtu;
#ifndef SMALL
- if (ioctl(s, SIOCGIFRDOMAIN, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFRDOMAIN, (caddr_t)ifr) == -1)
rdomainid = 0;
else
rdomainid = ifr->ifr_rdomainid;
#endif
- if (ioctl(s, SIOCGIFLLPRIO, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFLLPRIO, (caddr_t)ifr) == -1)
llprio = 0;
else
llprio = ifr->ifr_llprio;
@@ -1283,7 +1283,7 @@ setifrtlabel(const char *label, int d)
ifr.ifr_data = (caddr_t)(const char *)"";
else
ifr.ifr_data = (caddr_t)label;
- if (ioctl(s, SIOCSIFRTLABEL, &ifr) < 0)
+ if (ioctl(s, SIOCSIFRTLABEL, &ifr) == -1)
warn("SIOCSIFRTLABEL");
}
#endif
@@ -1308,7 +1308,7 @@ void
setifdesc(const char *val, int ignored)
{
ifr.ifr_data = (caddr_t)val;
- if (ioctl(s, SIOCSIFDESCR, &ifr) < 0)
+ if (ioctl(s, SIOCSIFDESCR, &ifr) == -1)
warn("SIOCSIFDESCR");
}
@@ -1317,7 +1317,7 @@ void
unsetifdesc(const char *noval, int ignored)
{
ifr.ifr_data = (caddr_t)(const char *)"";
- if (ioctl(s, SIOCSIFDESCR, &ifr) < 0)
+ if (ioctl(s, SIOCSIFDESCR, &ifr) == -1)
warn("SIOCSIFDESCR");
}
@@ -1370,7 +1370,7 @@ setifflags(const char *vname, int value)
bcopy((char *)&ifr, (char *)&my_ifr, sizeof(struct ifreq));
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) < 0)
+ if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&my_ifr) == -1)
err(1, "SIOCGIFFLAGS");
(void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name));
flags = my_ifr.ifr_flags;
@@ -1381,7 +1381,7 @@ setifflags(const char *vname, int value)
} else
flags |= value;
my_ifr.ifr_flags = flags;
- if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) < 0)
+ if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&my_ifr) == -1)
err(1, "SIOCSIFFLAGS");
}
@@ -1393,7 +1393,7 @@ setifxflags(const char *vname, int value)
bcopy((char *)&ifr, (char *)&my_ifr, sizeof(struct ifreq));
- if (ioctl(s, SIOCGIFXFLAGS, (caddr_t)&my_ifr) < 0)
+ if (ioctl(s, SIOCGIFXFLAGS, (caddr_t)&my_ifr) == -1)
warn("SIOCGIFXFLAGS");
(void) strlcpy(my_ifr.ifr_name, name, sizeof(my_ifr.ifr_name));
xflags = my_ifr.ifr_flags;
@@ -1404,7 +1404,7 @@ setifxflags(const char *vname, int value)
} else
xflags |= value;
my_ifr.ifr_flags = xflags;
- if (ioctl(s, SIOCSIFXFLAGS, (caddr_t)&my_ifr) < 0)
+ if (ioctl(s, SIOCSIFXFLAGS, (caddr_t)&my_ifr) == -1)
warn("SIOCSIFXFLAGS");
}
@@ -1415,7 +1415,7 @@ addaf(const char *vname, int value)
strlcpy(ifar.ifar_name, name, sizeof(ifar.ifar_name));
ifar.ifar_af = value;
- if (ioctl(s, SIOCIFAFATTACH, (caddr_t)&ifar) < 0)
+ if (ioctl(s, SIOCIFAFATTACH, (caddr_t)&ifar) == -1)
warn("SIOCIFAFATTACH");
}
@@ -1426,7 +1426,7 @@ removeaf(const char *vname, int value)
strlcpy(ifar.ifar_name, name, sizeof(ifar.ifar_name));
ifar.ifar_af = value;
- if (ioctl(s, SIOCIFAFDETACH, (caddr_t)&ifar) < 0)
+ if (ioctl(s, SIOCIFAFDETACH, (caddr_t)&ifar) == -1)
warn("SIOCIFAFDETACH");
}
@@ -1538,7 +1538,7 @@ setifmetric(const char *val, int ignored)
ifr.ifr_metric = strtonum(val, 0, INT_MAX, &errmsg);
if (errmsg)
errx(1, "metric %s: %s", val, errmsg);
- if (ioctl(s, SIOCSIFMETRIC, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFMETRIC, (caddr_t)&ifr) == -1)
warn("SIOCSIFMETRIC");
}
#endif
@@ -1554,7 +1554,7 @@ setifmtu(const char *val, int d)
ifr.ifr_mtu = strtonum(val, 0, INT_MAX, &errmsg);
if (errmsg)
errx(1, "mtu %s: %s", val, errmsg);
- if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFMTU, (caddr_t)&ifr) == -1)
warn("SIOCSIFMTU");
}
@@ -1569,7 +1569,7 @@ setifllprio(const char *val, int d)
ifr.ifr_llprio = strtonum(val, 0, UCHAR_MAX, &errmsg);
if (errmsg)
errx(1, "llprio %s: %s", val, errmsg);
- if (ioctl(s, SIOCSIFLLPRIO, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFLLPRIO, (caddr_t)&ifr) == -1)
warn("SIOCSIFLLPRIO");
}
@@ -1743,7 +1743,7 @@ setifnwid(const char *val, int d)
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
(void)strlcpy(nwidname, nwid.i_nwid, sizeof(nwidname));
ifr.ifr_data = (caddr_t)&nwid;
- if (ioctl(s, SIOCS80211NWID, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211NWID, (caddr_t)&ifr) == -1)
warn("SIOCS80211NWID");
}
@@ -1755,7 +1755,7 @@ process_join_commands(void)
return;
ifr.ifr_data = (caddr_t)&join;
- if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) == -1)
err(1, "SIOCS80211JOIN");
}
@@ -1802,7 +1802,7 @@ delifjoin(const char *val, int d)
if (d == -1) {
ifr.ifr_data = (caddr_t)&join;
- if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) == -1)
err(1, "SIOCS80211JOIN");
}
@@ -1814,7 +1814,7 @@ delifjoin(const char *val, int d)
join.i_flags |= IEEE80211_JOIN_ANY;
(void)strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)&join;
- if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) == -1)
err(1, "SIOCS80211JOIN");
}
@@ -1830,13 +1830,13 @@ delifjoinlist(const char *val, int d)
if (d == -1) {
ifr.ifr_data = (caddr_t)&join;
- if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) == -1)
err(1, "SIOCS80211JOIN");
return;
}
ifr.ifr_data = (caddr_t)&join;
- if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCS80211JOIN, (caddr_t)&ifr) == -1)
err(1, "SIOCS80211JOIN");
}
@@ -1980,7 +1980,7 @@ setifwpa(const char *val, int d)
return;
}
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2014,14 +2014,14 @@ setifwpaprotos(const char *val, int d)
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCG80211WPAPARMS");
wpa.i_protos = rval;
/* Let the kernel set up the appropriate default ciphers. */
wpa.i_ciphers = 0;
wpa.i_groupcipher = 0;
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2057,13 +2057,13 @@ setifwpaakms(const char *val, int d)
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCG80211WPAPARMS");
wpa.i_akms = rval;
/* Enable WPA for 802.1x here. PSK case is handled in setifwpakey(). */
wpa.i_enabled = ((rval & IEEE80211_WPA_AKM_8021X) != 0);
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2118,11 +2118,11 @@ setifwpaciphers(const char *val, int d)
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCG80211WPAPARMS");
wpa.i_ciphers = rval;
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2139,7 +2139,7 @@ setifwpagroupcipher(const char *val, int d)
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCG80211WPAPARMS");
wpa.i_groupcipher = cipher;
@@ -2149,7 +2149,7 @@ setifwpagroupcipher(const char *val, int d)
return;
}
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2177,7 +2177,7 @@ setifwpakey(const char *val, int d)
} else {
warnx("no nwid or join command, guessing nwid to use");
- if (ioctl(s, SIOCG80211NWID, (caddr_t)&ifr))
+ if (ioctl(s, SIOCG80211NWID, (caddr_t)&ifr) == -1)
err(1, "SIOCG80211NWID");
}
@@ -2214,16 +2214,16 @@ setifwpakey(const char *val, int d)
return;
}
- if (ioctl(s, SIOCS80211WPAPSK, (caddr_t)&psk) < 0)
+ if (ioctl(s, SIOCS80211WPAPSK, (caddr_t)&psk) == -1)
err(1, "SIOCS80211WPAPSK");
/* And ... automatically enable or disable WPA */
memset(&wpa, 0, sizeof(wpa));
(void)strlcpy(wpa.i_name, name, sizeof(wpa.i_name));
- if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCG80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCG80211WPAPARMS");
wpa.i_enabled = psk.i_enabled;
- if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) < 0)
+ if (ioctl(s, SIOCS80211WPAPARMS, (caddr_t)&wpa) == -1)
err(1, "SIOCS80211WPAPARMS");
}
@@ -2762,7 +2762,7 @@ init_current_media(void)
(void) memset(&ifmr, 0, sizeof(ifmr));
(void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
/*
* If we get E2BIG, the kernel is telling us
* that there are more, so we can ignore it.
@@ -2798,7 +2798,7 @@ process_media_commands(void)
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_media = media_current;
- if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) == -1)
err(1, "SIOCSIFMEDIA");
}
@@ -3169,7 +3169,7 @@ phys_status(int force)
memset(&req, 0, sizeof(req));
(void) strlcpy(req.iflr_name, name, sizeof(req.iflr_name));
- if (ioctl(s, SIOCGLIFPHYADDR, (caddr_t)&req) < 0) {
+ if (ioctl(s, SIOCGLIFPHYADDR, (caddr_t)&req) == -1) {
if (errno != EADDRNOTAVAIL)
return;
@@ -3309,7 +3309,7 @@ status(int link, struct sockaddr_dl *sdl, int ls)
(void) memset(&ifmr, 0, sizeof(ifmr));
(void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1) {
/*
* Interface doesn't support SIOC{G,S}IFMEDIA.
*/
@@ -3329,7 +3329,7 @@ status(int link, struct sockaddr_dl *sdl, int ls)
err(1, "calloc");
ifmr.ifm_ulist = media_list;
- if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0)
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) == -1)
err(1, "SIOCGIFMEDIA");
printf("\tmedia: ");
@@ -3440,7 +3440,7 @@ in_status(int force)
struct sockaddr_in *sin, sin2;
getsock(AF_INET);
- if (s < 0) {
+ if (s == -1) {
if (errno == EPROTONOSUPPORT)
return;
err(1, "socket");
@@ -3458,7 +3458,7 @@ in_status(int force)
printf("\tinet %s", inet_ntoa(sin->sin_addr));
(void) strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFNETMASK, (caddr_t)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFNETMASK, (caddr_t)&ifr) == -1) {
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFNETMASK");
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
@@ -3467,7 +3467,7 @@ in_status(int force)
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
if (flags & IFF_POINTOPOINT) {
memcpy(&ifr.ifr_addr, &sin2, sizeof(sin2));
- if (ioctl(s, SIOCGIFDSTADDR, (caddr_t)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFDSTADDR, (caddr_t)&ifr) == -1) {
if (errno == EADDRNOTAVAIL)
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
else
@@ -3480,7 +3480,7 @@ in_status(int force)
printf(" netmask 0x%x", ntohl(netmask.sin_addr.s_addr));
if (flags & IFF_BROADCAST) {
memcpy(&ifr.ifr_addr, &sin2, sizeof(sin2));
- if (ioctl(s, SIOCGIFBRDADDR, (caddr_t)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFBRDADDR, (caddr_t)&ifr) == -1) {
if (errno == EADDRNOTAVAIL)
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
else
@@ -3527,7 +3527,7 @@ in6_alias(struct in6_ifreq *creq)
/* Get the non-alias address for this interface. */
getsock(AF_INET6);
- if (s < 0) {
+ if (s == -1) {
if (errno == EPROTONOSUPPORT)
return;
err(1, "socket");
@@ -3546,7 +3546,7 @@ in6_alias(struct in6_ifreq *creq)
(void) memset(&ifr6, 0, sizeof(ifr6));
(void) strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
ifr6.ifr_addr = creq->ifr_addr;
- if (ioctl(s, SIOCGIFDSTADDR_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(s, SIOCGIFDSTADDR_IN6, (caddr_t)&ifr6) == -1) {
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFDSTADDR_IN6");
(void) memset(&ifr6.ifr_addr, 0, sizeof(ifr6.ifr_addr));
@@ -3564,7 +3564,7 @@ in6_alias(struct in6_ifreq *creq)
(void) memset(&ifr6, 0, sizeof(ifr6));
(void) strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
ifr6.ifr_addr = creq->ifr_addr;
- if (ioctl(s, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(s, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) == -1) {
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFNETMASK_IN6");
} else {
@@ -3576,7 +3576,7 @@ in6_alias(struct in6_ifreq *creq)
(void) memset(&ifr6, 0, sizeof(ifr6));
(void) strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
ifr6.ifr_addr = creq->ifr_addr;
- if (ioctl(s, SIOCGIFAFLAG_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(s, SIOCGIFAFLAG_IN6, (caddr_t)&ifr6) == -1) {
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFAFLAG_IN6");
} else {
@@ -3606,7 +3606,7 @@ in6_alias(struct in6_ifreq *creq)
(void) strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
ifr6.ifr_addr = creq->ifr_addr;
lifetime = &ifr6.ifr_ifru.ifru_lifetime;
- if (ioctl(s, SIOCGIFALIFETIME_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(s, SIOCGIFALIFETIME_IN6, (caddr_t)&ifr6) == -1) {
if (errno != EADDRNOTAVAIL)
warn("SIOCGIFALIFETIME_IN6");
} else if (lifetime->ia6t_preferred || lifetime->ia6t_expire) {
@@ -3677,7 +3677,7 @@ settunnel(const char *src, const char *dst)
(void) strlcpy(req.iflr_name, name, sizeof(req.iflr_name));
memcpy(&req.addr, srcres->ai_addr, srcres->ai_addrlen);
memcpy(&req.dstaddr, dstres->ai_addr, dstres->ai_addrlen);
- if (ioctl(s, SIOCSLIFPHYADDR, &req) < 0)
+ if (ioctl(s, SIOCSLIFPHYADDR, &req) == -1)
warn("SIOCSLIFPHYADDR");
freeaddrinfo(srcres);
@@ -3712,7 +3712,7 @@ settunneladdr(const char *addr, int ignored)
req.dstaddr.ss_len = 2;
req.dstaddr.ss_family = AF_UNSPEC;
- if (ioctl(s, SIOCSLIFPHYADDR, &req) < 0)
+ if (ioctl(s, SIOCSLIFPHYADDR, &req) == -1)
warn("tunneladdr %s", addr);
freeaddrinfo(res);
@@ -3722,7 +3722,7 @@ settunneladdr(const char *addr, int ignored)
void
deletetunnel(const char *ignored, int alsoignored)
{
- if (ioctl(s, SIOCDIFPHYADDR, &ifr) < 0)
+ if (ioctl(s, SIOCDIFPHYADDR, &ifr) == -1)
warn("SIOCDIFPHYADDR");
}
@@ -3738,7 +3738,7 @@ settunnelinst(const char *id, int param)
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_rdomainid = rdomainid;
- if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYRTABLE");
}
@@ -3747,7 +3747,7 @@ unsettunnelinst(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_rdomainid = 0;
- if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYRTABLE, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYRTABLE");
}
@@ -3767,7 +3767,7 @@ settunnelttl(const char *id, int param)
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_ttl = ttl;
- if (ioctl(s, SIOCSLIFPHYTTL, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYTTL, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYTTL");
}
@@ -3776,7 +3776,7 @@ settunneldf(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_df = 1;
- if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYDF");
}
@@ -3785,7 +3785,7 @@ settunnelnodf(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_df = 0;
- if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYDF, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYDF");
}
@@ -3794,7 +3794,7 @@ settunnelecn(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_metric = 1;
- if (ioctl(s, SIOCSLIFPHYECN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYECN, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYECN");
}
@@ -3803,7 +3803,7 @@ settunnelnoecn(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_metric = 0;
- if (ioctl(s, SIOCSLIFPHYECN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSLIFPHYECN, (caddr_t)&ifr) == -1)
warn("SIOCSLIFPHYECN");
}
@@ -3815,7 +3815,7 @@ setvnetflowid(const char *ignored, int alsoignored)
errx(1, "vnetflowid: name is too long");
ifr.ifr_vnetid = 1;
- if (ioctl(s, SIOCSVNETFLOWID, &ifr) < 0)
+ if (ioctl(s, SIOCSVNETFLOWID, &ifr) == -1)
warn("SIOCSVNETFLOWID");
}
@@ -3827,7 +3827,7 @@ delvnetflowid(const char *ignored, int alsoignored)
errx(1, "vnetflowid: name is too long");
ifr.ifr_vnetid = 0;
- if (ioctl(s, SIOCSVNETFLOWID, &ifr) < 0)
+ if (ioctl(s, SIOCSVNETFLOWID, &ifr) == -1)
warn("SIOCSVNETFLOWID");
}
@@ -4095,7 +4095,7 @@ setvnetid(const char *id, int param)
}
ifr.ifr_vnetid = vnetid;
- if (ioctl(s, SIOCSVNETID, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSVNETID, (caddr_t)&ifr) == -1)
warn("SIOCSVNETID");
}
@@ -4103,7 +4103,7 @@ setvnetid(const char *id, int param)
void
delvnetid(const char *ignored, int alsoignored)
{
- if (ioctl(s, SIOCDVNETID, &ifr) < 0)
+ if (ioctl(s, SIOCDVNETID, &ifr) == -1)
warn("SIOCDVNETID");
}
@@ -4144,7 +4144,7 @@ setifparent(const char *id, int param)
sizeof(ifp.ifp_parent))
errx(1, "parent: parent too long");
- if (ioctl(s, SIOCSIFPARENT, (caddr_t)&ifp) < 0)
+ if (ioctl(s, SIOCSIFPARENT, (caddr_t)&ifp) == -1)
warn("SIOCSIFPARENT");
}
@@ -4152,7 +4152,7 @@ setifparent(const char *id, int param)
void
delifparent(const char *ignored, int alsoignored)
{
- if (ioctl(s, SIOCDIFPARENT, &ifr) < 0)
+ if (ioctl(s, SIOCDIFPARENT, &ifr) == -1)
warn("SIOCDIFPARENT");
}
@@ -4213,7 +4213,7 @@ settxprio(const char *val, int d)
errx(1, "tx prio %s: %s", val, errmsg);
}
- if (ioctl(s, SIOCSTXHPRIO, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSTXHPRIO, (caddr_t)&ifr) == -1)
warn("SIOCSTXHPRIO");
}
@@ -4253,7 +4253,7 @@ setrxprio(const char *val, int d)
errx(1, "rx prio %s: %s", val, errmsg);
}
- if (ioctl(s, SIOCSRXHPRIO, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSRXHPRIO, (caddr_t)&ifr) == -1)
warn("SIOCSRXHPRIO");
}
#endif
@@ -4346,7 +4346,7 @@ settrunkport(const char *val, int d)
strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname));
- if (ioctl(s, SIOCSTRUNKPORT, &rp))
+ if (ioctl(s, SIOCSTRUNKPORT, &rp) == -1)
err(1, "SIOCSTRUNKPORT");
}
@@ -4359,7 +4359,7 @@ unsettrunkport(const char *val, int d)
strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname));
strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname));
- if (ioctl(s, SIOCSTRUNKDELPORT, &rp))
+ if (ioctl(s, SIOCSTRUNKDELPORT, &rp) == -1)
err(1, "SIOCSTRUNKDELPORT");
}
@@ -5217,7 +5217,7 @@ pppoe_status(void)
memset(&state, 0, sizeof(state));
strlcpy(parms.ifname, name, sizeof(parms.ifname));
- if (ioctl(s, PPPOEGETPARMS, &parms))
+ if (ioctl(s, PPPOEGETPARMS, &parms) == -1)
return;
printf("\tdev: %s ", parms.eth_ifname);
@@ -5228,7 +5228,7 @@ pppoe_status(void)
printf("svc: %s ", parms.service_name);
strlcpy(state.ifname, name, sizeof(state.ifname));
- if (ioctl(s, PPPOEGETSESSION, &state))
+ if (ioctl(s, PPPOEGETSESSION, &state) == -1)
err(1, "PPPOEGETSESSION");
printf("state: ");
@@ -5284,12 +5284,12 @@ setpppoe_dev(const char *val, int d)
struct pppoediscparms parms;
strlcpy(parms.ifname, name, sizeof(parms.ifname));
- if (ioctl(s, PPPOEGETPARMS, &parms))
+ if (ioctl(s, PPPOEGETPARMS, &parms) == -1)
return;
strlcpy(parms.eth_ifname, val, sizeof(parms.eth_ifname));
- if (ioctl(s, PPPOESETPARMS, &parms))
+ if (ioctl(s, PPPOESETPARMS, &parms) == -1)
err(1, "PPPOESETPARMS");
}
@@ -5300,7 +5300,7 @@ setpppoe_svc(const char *val, int d)
struct pppoediscparms parms;
strlcpy(parms.ifname, name, sizeof(parms.ifname));
- if (ioctl(s, PPPOEGETPARMS, &parms))
+ if (ioctl(s, PPPOEGETPARMS, &parms) == -1)
return;
if (d == 0)
@@ -5308,7 +5308,7 @@ setpppoe_svc(const char *val, int d)
else
memset(parms.service_name, 0, sizeof(parms.service_name));
- if (ioctl(s, PPPOESETPARMS, &parms))
+ if (ioctl(s, PPPOESETPARMS, &parms) == -1)
err(1, "PPPOESETPARMS");
}
@@ -5319,7 +5319,7 @@ setpppoe_ac(const char *val, int d)
struct pppoediscparms parms;
strlcpy(parms.ifname, name, sizeof(parms.ifname));
- if (ioctl(s, PPPOEGETPARMS, &parms))
+ if (ioctl(s, PPPOEGETPARMS, &parms) == -1)
return;
if (d == 0)
@@ -5327,7 +5327,7 @@ setpppoe_ac(const char *val, int d)
else
memset(parms.ac_name, 0, sizeof(parms.ac_name));
- if (ioctl(s, PPPOESETPARMS, &parms))
+ if (ioctl(s, PPPOESETPARMS, &parms) == -1)
err(1, "PPPOESETPARMS");
}
@@ -5534,7 +5534,7 @@ setkeepalive(const char *timeout, const char *count)
strlcpy(ikar.ikar_name, name, sizeof(ikar.ikar_name));
ikar.ikar_timeo = t;
ikar.ikar_cnt = c;
- if (ioctl(s, SIOCSETKALIVE, (caddr_t)&ikar) < 0)
+ if (ioctl(s, SIOCSETKALIVE, (caddr_t)&ikar) == -1)
warn("SIOCSETKALIVE");
}
@@ -5545,7 +5545,7 @@ unsetkeepalive(const char *val, int d)
bzero(&ikar, sizeof(ikar));
strlcpy(ikar.ikar_name, name, sizeof(ikar.ikar_name));
- if (ioctl(s, SIOCSETKALIVE, (caddr_t)&ikar) < 0)
+ if (ioctl(s, SIOCSETKALIVE, (caddr_t)&ikar) == -1)
warn("SIOCSETKALIVE");
}
@@ -5561,7 +5561,7 @@ setifpriority(const char *id, int param)
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_metric = prio;
- if (ioctl(s, SIOCSIFPRIORITY, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFPRIORITY, (caddr_t)&ifr) == -1)
warn("SIOCSIFPRIORITY");
}
@@ -6288,7 +6288,7 @@ setiflladdr(const char *addr, int param)
ifr.ifr_addr.sa_len = ETHER_ADDR_LEN;
ifr.ifr_addr.sa_family = AF_LINK;
bcopy(eap, ifr.ifr_addr.sa_data, ETHER_ADDR_LEN);
- if (ioctl(s, SIOCSIFLLADDR, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFLLADDR, (caddr_t)&ifr) == -1)
warn("SIOCSIFLLADDR");
}
@@ -6305,7 +6305,7 @@ setrdomain(const char *id, int param)
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_rdomainid = rdomainid;
- if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) == -1)
warn("SIOCSIFRDOMAIN");
}
@@ -6314,7 +6314,7 @@ unsetrdomain(const char *ignored, int alsoignored)
{
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
ifr.ifr_rdomainid = 0;
- if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFRDOMAIN, (caddr_t)&ifr) == -1)
warn("SIOCSIFRDOMAIN");
}
#endif
@@ -6328,7 +6328,7 @@ setpair(const char *val, int d)
errno = ENOENT;
err(1, "patch %s", val);
}
- if (ioctl(s, SIOCSIFPAIR, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFPAIR, (caddr_t)&ifr) == -1)
warn("SIOCSIFPAIR");
}
@@ -6337,7 +6337,7 @@ unsetpair(const char *val, int d)
{
ifr.ifr_index = 0;
strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCSIFPAIR, (caddr_t)&ifr) < 0)
+ if (ioctl(s, SIOCSIFPAIR, (caddr_t)&ifr) == -1)
warn("SIOCSIFPAIR");
}
#endif
diff --git a/sbin/iked/ocsp.c b/sbin/iked/ocsp.c
index 827a501c0f0..f5a379d8a0b 100644
--- a/sbin/iked/ocsp.c
+++ b/sbin/iked/ocsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ocsp.c,v 1.8 2015/12/07 12:46:37 reyk Exp $ */
+/* $OpenBSD: ocsp.c,v 1.9 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2014 Markus Friedl
@@ -88,7 +88,7 @@ ocsp_connect(struct iked *env)
goto done;
}
- if ((fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0)) < 0) {
+ if ((fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1) {
log_debug("%s: socket failed", __func__);
goto done;
}
@@ -159,7 +159,7 @@ ocsp_connect_cb(int fd, short event, void *arg)
socklen_t len;
len = sizeof(error);
- if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
+ if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &len) == -1) {
log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__);
} else if (error) {
log_debug("%s: error while connecting: %s", __func__,
diff --git a/sbin/iked/parse.y b/sbin/iked/parse.y
index e6abde0a2fd..b47aff5dbe2 100644
--- a/sbin/iked/parse.y
+++ b/sbin/iked/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.80 2019/05/11 16:30:23 patrick Exp $ */
+/* $OpenBSD: parse.y,v 1.81 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
@@ -1735,9 +1735,9 @@ parsekeyfile(char *filename, struct iked_auth *auth)
int fd, ret;
unsigned char *hex;
- if ((fd = open(filename, O_RDONLY)) < 0)
+ if ((fd = open(filename, O_RDONLY)) == -1)
err(1, "open %s", filename);
- if (fstat(fd, &sb) < 0)
+ if (fstat(fd, &sb) == -1)
err(1, "parsekeyfile: stat %s", filename);
if ((sb.st_size > KEYSIZE_LIMIT) || (sb.st_size == 0))
errx(1, "%s: key too %s", filename, sb.st_size ? "large" :
@@ -2187,7 +2187,7 @@ ifa_load(void)
struct sockaddr_in *sa_in;
struct sockaddr_in6 *sa_in6;
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
err(1, "ifa_load: getifaddrs");
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
diff --git a/sbin/init/init.c b/sbin/init/init.c
index f854c6acc3a..b23c6fd1f48 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.68 2018/08/24 18:36:56 cheloha Exp $ */
+/* $OpenBSD: init.c,v 1.69 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -226,14 +226,14 @@ main(int argc, char *argv[])
/*
* Create an initial session.
*/
- if (setsid() < 0)
+ if (setsid() == -1)
warning("initial setsid() failed: %m");
/*
* Establish an initial user so that programs running
* single user do not freak out and die (like passwd).
*/
- if (setlogin("root") < 0)
+ if (setlogin("root") == -1)
warning("setlogin() failed: %m");
/*
@@ -967,7 +967,7 @@ start_window_system(session_t *sp)
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
- if (setsid() < 0)
+ if (setsid() == -1)
emergency("setsid failed (window) %m");
setprocresources(RESOURCE_WINDOW);
diff --git a/sbin/ipsecctl/pfkey.c b/sbin/ipsecctl/pfkey.c
index d49ad4e0d2c..1f7aa0c0522 100644
--- a/sbin/ipsecctl/pfkey.c
+++ b/sbin/ipsecctl/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.60 2017/04/19 15:59:38 bluhm Exp $ */
+/* $OpenBSD: pfkey.c,v 1.61 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* Copyright (c) 2003, 2004 Markus Friedl <markus@openbsd.org>
@@ -1315,7 +1315,7 @@ pfkey_monitor(int opts)
pfd[0].fd = fd;
pfd[0].events = POLLIN;
for (;;) {
- if ((n = poll(pfd, 1, -1)) < 0)
+ if ((n = poll(pfd, 1, -1)) == -1)
err(2, "poll");
if (n == 0)
break;
diff --git a/sbin/isakmpd/if.c b/sbin/isakmpd/if.c
index e30cbffd41f..0c6fad48d79 100644
--- a/sbin/isakmpd/if.c
+++ b/sbin/isakmpd/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.25 2005/04/08 22:32:10 cloder Exp $ */
+/* $OpenBSD: if.c,v 1.26 2019/06/28 13:32:44 deraadt Exp $ */
/* $EOM: if.c,v 1.12 1999/10/01 13:45:20 niklas Exp $ */
/*
@@ -48,7 +48,7 @@ if_map(int (*func)(char *, struct sockaddr *, void *), void *arg)
struct ifaddrs *ifap, *ifa;
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
return -1;
for (ifa = ifap; ifa; ifa = ifa->ifa_next)
diff --git a/sbin/isakmpd/ike_auth.c b/sbin/isakmpd/ike_auth.c
index 776ac32b143..8d8e26fc6f5 100644
--- a/sbin/isakmpd/ike_auth.c
+++ b/sbin/isakmpd/ike_auth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ike_auth.c,v 1.116 2018/01/15 09:54:48 mpi Exp $ */
+/* $OpenBSD: ike_auth.c,v 1.117 2019/06/28 13:32:44 deraadt Exp $ */
/* $EOM: ike_auth.c,v 1.59 2000/11/21 00:21:31 angelos Exp $ */
/*
@@ -201,7 +201,7 @@ ike_auth_get_key(int type, char *id, char *local_id, size_t *keylen)
goto ignorekeynote;
}
- if (fstat(fd, &sb) < 0) {
+ if (fstat(fd, &sb) == -1) {
log_print("ike_auth_get_key: fstat failed");
free(keyfile);
close(fd);
@@ -276,7 +276,7 @@ ignorekeynote:
keyfile = privkeyfile;
fd = monitor_open(keyfile, O_RDONLY, 0);
- if (fd < 0 && errno != ENOENT) {
+ if (fd == -1 && errno != ENOENT) {
log_print("ike_auth_get_key: failed opening "
"\"%s\"", keyfile);
free(privkeyfile);
@@ -285,13 +285,13 @@ ignorekeynote:
}
}
- if (fd < 0) {
+ if (fd == -1) {
/* No key found, try default key. */
keyfile = conf_get_str("X509-certificates",
"Private-key");
fd = monitor_open(keyfile, O_RDONLY, 0);
- if (fd < 0) {
+ if (fd == -1) {
log_print("ike_auth_get_key: failed opening "
"\"%s\"", keyfile);
return 0;
diff --git a/sbin/isakmpd/monitor.c b/sbin/isakmpd/monitor.c
index 37cd7eac918..1510438d26c 100644
--- a/sbin/isakmpd/monitor.c
+++ b/sbin/isakmpd/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.76 2018/01/15 09:54:48 mpi Exp $ */
+/* $OpenBSD: monitor.c,v 1.77 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2003 Håkan Olsson. All rights reserved.
@@ -611,7 +611,7 @@ m_priv_bind(void)
v = -1;
} else {
v = bind(sock, name, namelen);
- if (v < 0) {
+ if (v == -1) {
log_error("m_priv_bind: bind(%d,%p,%d) returned %d",
sock, name, namelen, v);
err = errno;
diff --git a/sbin/isakmpd/policy.c b/sbin/isakmpd/policy.c
index 6a717cd4660..ca45fc950f2 100644
--- a/sbin/isakmpd/policy.c
+++ b/sbin/isakmpd/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.99 2018/01/15 09:54:48 mpi Exp $ */
+/* $OpenBSD: policy.c,v 1.100 2019/06/28 13:32:44 deraadt Exp $ */
/* $EOM: policy.c,v 1.49 2000/10/24 13:33:39 niklas Exp $ */
/*
@@ -2182,7 +2182,7 @@ keynote_cert_obtain(u_int8_t *id, size_t id_len, void *data, u_int8_t **cert,
return 0;
}
- if (fstat(fd, &sb) < 0) {
+ if (fstat(fd, &sb) == -1) {
LOG_DBG((LOG_POLICY, 30, "keynote_cert_obtain: "
"failed to stat \"%s\"", file));
free(file);
diff --git a/sbin/isakmpd/util.c b/sbin/isakmpd/util.c
index 7263465dacb..ad54be2b874 100644
--- a/sbin/isakmpd/util.c
+++ b/sbin/isakmpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.71 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: util.c,v 1.72 2019/06/28 13:32:44 deraadt Exp $ */
/* $EOM: util.c,v 1.23 2000/11/23 12:22:08 niklas Exp $ */
/*
@@ -252,7 +252,7 @@ text2sockaddr(char *address, char *port, struct sockaddr **sa, sa_family_t af,
rtm->rtm_addrs |= RTA_NETMASK|RTA_IFP|RTA_IFA;
rtm->rtm_msglen = sizeof(*rtm) + sizeof(*sa2);
- if ((b = write(fd, buf, rtm->rtm_msglen)) < 0) {
+ if ((b = write(fd, buf, rtm->rtm_msglen)) == -1) {
close(fd);
return -1;
}
diff --git a/sbin/isakmpd/virtual.c b/sbin/isakmpd/virtual.c
index 4a7e672fa75..52a692a72c0 100644
--- a/sbin/isakmpd/virtual.c
+++ b/sbin/isakmpd/virtual.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: virtual.c,v 1.32 2015/08/20 22:02:21 deraadt Exp $ */
+/* $OpenBSD: virtual.c,v 1.33 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2004 Håkan Olsson. All rights reserved.
@@ -419,7 +419,7 @@ virtual_bind_if(char *ifname, struct sockaddr *if_addr, void *arg)
memset(&flags_ifr6, 0, sizeof(flags_ifr6));
strlcpy(flags_ifr6.ifr_name, ifname, sizeof flags_ifr6.ifr_name);
flags_ifr6.ifr_addr = *(struct sockaddr_in6 *)if_addr;
- if (ioctl(s, SIOCGIFAFLAG_IN6, (caddr_t)&flags_ifr6) < 0) {
+ if (ioctl(s, SIOCGIFAFLAG_IN6, (caddr_t)&flags_ifr6) == -1) {
log_error("virtual_bind_if: "
"ioctl (%d, SIOCGIFAFLAG_IN6, ...) failed", s);
close(s);
diff --git a/sbin/kbd/kbd_wscons.c b/sbin/kbd/kbd_wscons.c
index 11828bdcb23..af25d2d0ffa 100644
--- a/sbin/kbd/kbd_wscons.c
+++ b/sbin/kbd/kbd_wscons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kbd_wscons.c,v 1.32 2016/10/03 13:03:49 jca Exp $ */
+/* $OpenBSD: kbd_wscons.c,v 1.33 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2001 Mats O Jansson. All rights reserved.
@@ -136,7 +136,7 @@ kbd_get_encs(int fd, struct wskbd_encoding_data *encs)
encs->nencodings, sizeof(kbd_t));
if (encs->encodings == NULL)
err(1, NULL);
- if (ioctl(fd, WSKBDIO_GETENCODINGS, encs) < 0)
+ if (ioctl(fd, WSKBDIO_GETENCODINGS, encs) == -1)
err(1, "WSKBDIO_GETENCODINGS");
if (encs->nencodings == nencodings) {
nencodings *= 2;
@@ -160,10 +160,10 @@ kbd_list(void)
for (i = 0; i < NUM_KBD; i++) {
(void) snprintf(device, sizeof device, "/dev/wskbd%d", i);
fd = open(device, O_WRONLY);
- if (fd < 0)
+ if (fd == -1)
fd = open(device, O_RDONLY);
if (fd >= 0) {
- if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0)
+ if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) == -1)
err(1, "WSKBDIO_GTYPE");
switch (kbtype) {
case WSKBD_TYPE_PC_XT:
@@ -258,10 +258,10 @@ kbd_set(char *name, int verbose)
for (i = 0; i < NUM_KBD; i++) {
(void) snprintf(device, sizeof device, "/dev/wskbd%d", i);
fd = open(device, O_WRONLY);
- if (fd < 0)
+ if (fd == -1)
fd = open(device, O_RDONLY);
if (fd >= 0) {
- if (ioctl(fd, WSKBDIO_SETENCODING, &map) < 0) {
+ if (ioctl(fd, WSKBDIO_SETENCODING, &map) == -1) {
if (errno == EINVAL) {
fprintf(stderr,
"%s: unsupported encoding %s on %s\n",
diff --git a/sbin/ldattach/ldattach.c b/sbin/ldattach/ldattach.c
index c133d1d6bd6..042f119cefa 100644
--- a/sbin/ldattach/ldattach.c
+++ b/sbin/ldattach/ldattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldattach.c,v 1.17 2016/11/26 11:18:43 mpi Exp $ */
+/* $OpenBSD: ldattach.c,v 1.18 2019/06/28 13:32:44 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008 Marc Balmer <mbalmer@openbsd.org>
@@ -210,7 +210,7 @@ main(int argc, char *argv[])
goto bail_out;
}
- if ((fd = open(dev, O_RDWR)) < 0) {
+ if ((fd = open(dev, O_RDWR)) == -1) {
syslog(LOG_ERR, "can't open %s", dev);
goto bail_out;
}
@@ -221,7 +221,7 @@ main(int argc, char *argv[])
* the line discipline (e.g. nmea has a default baudrate of
* 4800 instead of 9600).
*/
- if (tcgetattr(fd, &tty) < 0) {
+ if (tcgetattr(fd, &tty) == -1) {
if (ppid != 1)
warnx("tcgetattr");
goto bail_out;
@@ -258,9 +258,9 @@ main(int argc, char *argv[])
cfsetspeed(&tty, speed);
/* setup common to all line disciplines */
- if (ioctl(fd, TIOCSDTR, 0) < 0)
+ if (ioctl(fd, TIOCSDTR, 0) == -1)
warn("TIOCSDTR");
- if (ioctl(fd, TIOCSETD, &ldisc) < 0) {
+ if (ioctl(fd, TIOCSETD, &ldisc) == -1) {
syslog(LOG_ERR, "can't attach %s line discipline on %s", disc,
dev);
goto bail_out;
@@ -271,7 +271,7 @@ main(int argc, char *argv[])
case NMEADISC:
case MSTSDISC:
case ENDRUNDISC:
- if (ioctl(fd, TIOCSTSTAMP, &tstamps) < 0) {
+ if (ioctl(fd, TIOCSTSTAMP, &tstamps) == -1) {
warnx("TIOCSTSTAMP");
goto bail_out;
}
@@ -285,7 +285,7 @@ main(int argc, char *argv[])
}
/* finally set the line attributes */
- if (tcsetattr(fd, TCSADRAIN, &tty) < 0) {
+ if (tcsetattr(fd, TCSADRAIN, &tty) == -1) {
if (ppid != 1)
warnx("tcsetattr");
goto bail_out;
diff --git a/sbin/mknod/mknod.c b/sbin/mknod/mknod.c
index f64b5edb252..2b80d6aeca5 100644
--- a/sbin/mknod/mknod.c
+++ b/sbin/mknod/mknod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mknod.c,v 1.30 2016/10/20 10:24:40 schwarze Exp $ */
+/* $OpenBSD: mknod.c,v 1.31 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: mknod.c,v 1.8 1995/08/11 00:08:18 jtc Exp $ */
/*
@@ -196,7 +196,7 @@ domakenodes(struct node *node, int n)
}
r = mknod(node[i].name, node[i].mode, node[i].dev);
- if (r < 0) {
+ if (r == -1) {
warn("%s", node[i].name);
rv = 1;
}
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index 19e185f061e..105b3b46bc0 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getmntopts.c,v 1.12 2015/01/16 06:39:59 deraadt Exp $ */
+/* $OpenBSD: getmntopts.c,v 1.13 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: getmntopts.c,v 1.3 1995/03/18 14:56:58 cgd Exp $ */
/*-
@@ -114,7 +114,7 @@ getmntopt(char **optionp, union mntval *valuep, const struct mntopt *m0,
if (m->m_oflags & MFLAG_INTVAL) {
errno = 0;
l = strtol(value, &endp, 10);
- if (endp == value || l < 0 || l > INT_MAX ||
+ if (endp == value || l == -1 || l > INT_MAX ||
(l == LONG_MAX && errno == ERANGE))
errx(1, "%s: illegal value '%s'",
opt, value);
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 3a43dc4324b..67bd625ec58 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.c,v 1.71 2017/02/06 17:15:56 tb Exp $ */
+/* $OpenBSD: mount.c,v 1.72 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
@@ -380,7 +380,7 @@ mountfs(const char *vfstype, const char *spec, const char *name,
if (!hasopt(optbuf, "update"))
optbuf = catopt(optbuf, "update");
} else if (skipmounted) {
- if (statfs(name, &sf) < 0) {
+ if (statfs(name, &sf) == -1) {
warn("statfs %s", name);
return (1);
}
@@ -446,7 +446,7 @@ mountfs(const char *vfstype, const char *spec, const char *name,
free(optbuf);
free(argv);
- if (waitpid(pid, &status, 0) < 0) {
+ if (waitpid(pid, &status, 0) == -1) {
warn("waitpid");
return (1);
}
@@ -460,7 +460,7 @@ mountfs(const char *vfstype, const char *spec, const char *name,
}
if (verbose) {
- if (statfs(name, &sf) < 0) {
+ if (statfs(name, &sf) == -1) {
warn("statfs %s", name);
return (1);
}
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index 9c6b59725e5..2bc61f70f75 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_cd9660.c,v 1.21 2015/01/16 06:39:59 deraadt Exp $ */
+/* $OpenBSD: mount_cd9660.c,v 1.22 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: mount_cd9660.c,v 1.3 1996/04/13 01:31:08 jtc Exp $ */
/*
@@ -117,7 +117,7 @@ main(int argc, char *argv[])
args.flags = opts;
args.sess = sess;
- if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0) {
+ if (mount(MOUNT_CD9660, dir, mntflags, &args) == -1) {
if (errno == EOPNOTSUPP)
errx(1, "%s: Filesystem not supported by kernel", dir);
else
diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c
index 9e77a3edb85..261cf151f50 100644
--- a/sbin/mount_ext2fs/mount_ext2fs.c
+++ b/sbin/mount_ext2fs/mount_ext2fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_ext2fs.c,v 1.18 2015/12/08 15:56:42 tedu Exp $ */
+/* $OpenBSD: mount_ext2fs.c,v 1.19 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: mount_ffs.c,v 1.3 1996/04/13 01:31:19 jtc Exp $ */
/*-
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
else
args.export_info.ex_flags = 0;
- if (mount(MOUNT_EXT2FS, fs_name, mntflags, &args) < 0) {
+ if (mount(MOUNT_EXT2FS, fs_name, mntflags, &args) == -1) {
switch (errno) {
case EMFILE:
errcause = "mount table full";
diff --git a/sbin/mount_ffs/mount_ffs.c b/sbin/mount_ffs/mount_ffs.c
index 35fa8abf230..b3915ee27b8 100644
--- a/sbin/mount_ffs/mount_ffs.c
+++ b/sbin/mount_ffs/mount_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_ffs.c,v 1.24 2016/09/10 16:53:30 natano Exp $ */
+/* $OpenBSD: mount_ffs.c,v 1.25 2019/06/28 13:32:44 deraadt Exp $ */
/* $NetBSD: mount_ffs.c,v 1.3 1996/04/13 01:31:19 jtc Exp $ */
/*-
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
if (mntflags & MNT_NOPERM)
mntflags |= MNT_NODEV | MNT_NOEXEC;
- if (mount(MOUNT_FFS, fs_name, mntflags, &args) < 0) {
+ if (mount(MOUNT_FFS, fs_name, mntflags, &args) == -1) {
switch (errno) {
case EMFILE:
errcause = "mount table full";
diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c
index 707adc8840e..4e4c042d5e9 100644
--- a/sbin/mount_msdos/mount_msdos.c
+++ b/sbin/mount_msdos/mount_msdos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_msdos.c,v 1.33 2016/05/21 19:14:02 jmc Exp $ */
+/* $OpenBSD: mount_msdos.c,v 1.34 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */
/*
@@ -129,7 +129,7 @@ main(int argc, char **argv)
args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
}
- if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0) {
+ if (mount(MOUNT_MSDOS, dir, mntflags, &args) == -1) {
switch (errno) {
case EOPNOTSUPP:
errcause = "filesystem not supported by kernel";
diff --git a/sbin/mount_ntfs/mount_ntfs.c b/sbin/mount_ntfs/mount_ntfs.c
index 6737c123c32..9766cc4a402 100644
--- a/sbin/mount_ntfs/mount_ntfs.c
+++ b/sbin/mount_ntfs/mount_ntfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_ntfs.c,v 1.16 2015/12/30 21:38:28 millert Exp $ */
+/* $OpenBSD: mount_ntfs.c,v 1.17 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: mount_ntfs.c,v 1.9 2003/05/03 15:37:08 christos Exp $ */
/*
@@ -121,7 +121,7 @@ main(int argc, char *argv[])
if (!set_mask)
args.mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
}
- if (mount(MOUNT_NTFS, dir, mntflags, &args) < 0)
+ if (mount(MOUNT_NTFS, dir, mntflags, &args) == -1)
err(1, "%s on %s", dev, dir);
exit(0);
diff --git a/sbin/mount_udf/mount_udf.c b/sbin/mount_udf/mount_udf.c
index 121146b5b7f..124662568f2 100644
--- a/sbin/mount_udf/mount_udf.c
+++ b/sbin/mount_udf/mount_udf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_udf.c,v 1.7 2015/01/16 06:39:59 deraadt Exp $ */
+/* $OpenBSD: mount_udf.c,v 1.8 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net>
@@ -56,7 +56,7 @@ lastblock(char *dev)
struct cd_toc_entry te;
fd = open(dev, O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
err(1, "open");
t.address_format = CD_LBA_FORMAT;
@@ -99,7 +99,7 @@ main(int argc, char **argv)
if (realpath(argv[1], node) == NULL)
err(1, "realpath %s", argv[1]);
- if (mount(MOUNT_UDF, node, flags, &args) < 0)
+ if (mount(MOUNT_UDF, node, flags, &args) == -1)
err(1, "mount");
exit(0);
diff --git a/sbin/mount_vnd/mount_vnd.c b/sbin/mount_vnd/mount_vnd.c
index 8b04f6307e9..f39db6cb048 100644
--- a/sbin/mount_vnd/mount_vnd.c
+++ b/sbin/mount_vnd/mount_vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount_vnd.c,v 1.21 2019/04/25 22:39:46 deraadt Exp $ */
+/* $OpenBSD: mount_vnd.c,v 1.22 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 1993 University of Utah.
* Copyright (c) 1990, 1993
@@ -190,7 +190,7 @@ config(char *dev, char *file, struct disklabel *dp, char *key, size_t keylen)
char *rdev;
int fd, rv = -1;
- if ((fd = opendev(dev, O_RDONLY, OPENDEV_PART, &rdev)) < 0) {
+ if ((fd = opendev(dev, O_RDONLY, OPENDEV_PART, &rdev)) == -1) {
err(4, "%s", rdev);
goto out;
}
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 0e09071a5df..40b09fc2cb7 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mountd.c,v 1.86 2018/04/28 09:56:21 guenther Exp $ */
+/* $OpenBSD: mountd.c,v 1.87 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
@@ -780,9 +780,9 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
fprintf(stderr, "realpath failed on %s\n",
rpcpath);
strlcpy(dirpath, rpcpath, sizeof(dirpath));
- } else if (stat(dirpath, &stb) < 0 ||
+ } else if (stat(dirpath, &stb) == -1 ||
(!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) ||
- statfs(dirpath, &fsb) < 0) {
+ statfs(dirpath, &fsb) == -1) {
if (debug)
fprintf(stderr, "stat failed on %s\n", dirpath);
bad = ENOENT; /* We will send error reply later */
@@ -2408,13 +2408,13 @@ check_dirpath(char *dirp)
while (*cp && ret) {
if (*cp == '/') {
*cp = '\0';
- if (lstat(dirp, &sb) < 0 || !S_ISDIR(sb.st_mode))
+ if (lstat(dirp, &sb) == -1 || !S_ISDIR(sb.st_mode))
ret = 0;
*cp = '/';
}
cp++;
}
- if (lstat(dirp, &sb) < 0 ||
+ if (lstat(dirp, &sb) == -1 ||
(!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode)))
ret = 0;
return (ret);
diff --git a/sbin/ncheck_ffs/ncheck_ffs.c b/sbin/ncheck_ffs/ncheck_ffs.c
index 93a72900020..aa12a3a1736 100644
--- a/sbin/ncheck_ffs/ncheck_ffs.c
+++ b/sbin/ncheck_ffs/ncheck_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncheck_ffs.c,v 1.53 2016/05/28 23:46:06 tb Exp $ */
+/* $OpenBSD: ncheck_ffs.c,v 1.54 2019/06/28 13:32:45 deraadt Exp $ */
/*-
* Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
@@ -571,7 +571,7 @@ main(int argc, char *argv[])
err(1, "cannot find real path for %s", disk);
disk = rdisk;
- if (stat(disk, &stblock) < 0)
+ if (stat(disk, &stblock) == -1)
err(1, "cannot stat %s", disk);
if (S_ISBLK(stblock.st_mode)) {
@@ -582,13 +582,13 @@ main(int argc, char *argv[])
disk = rawname(fsp->fs_spec);
}
- if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) < 0)
+ if ((diskfd = opendev(disk, O_RDONLY, 0, NULL)) == -1)
err(1, "cannot open %s", disk);
gotdev:
- if (ioctl(diskfd, DIOCGDINFO, (char *)&lab) < 0)
+ if (ioctl(diskfd, DIOCGDINFO, (char *)&lab) == -1)
err(1, "ioctl (DIOCGDINFO)");
- if (ioctl(diskfd, DIOCGPDINFO, (char *)&lab) < 0)
+ if (ioctl(diskfd, DIOCGPDINFO, (char *)&lab) == -1)
err(1, "ioctl (DIOCGPDINFO)");
if (pledge("stdio", NULL) == -1)
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c
index 349e669a295..5276b791028 100644
--- a/sbin/newfs/newfs.c
+++ b/sbin/newfs/newfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs.c,v 1.111 2018/11/25 17:12:10 krw Exp $ */
+/* $OpenBSD: newfs.c,v 1.112 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
@@ -380,7 +380,7 @@ main(int argc, char *argv[])
fso = -1;
} else {
fso = opendev(special, O_WRONLY, 0, &realdev);
- if (fso < 0)
+ if (fso == -1)
fatal("%s: %s", special, strerror(errno));
special = realdev;
@@ -413,9 +413,9 @@ main(int argc, char *argv[])
pp = &lp->d_partitions[1];
} else {
fsi = opendev(special, O_RDONLY, 0, NULL);
- if (fsi < 0)
+ if (fsi == -1)
fatal("%s: %s", special, strerror(errno));
- if (fstat(fsi, &st) < 0)
+ if (fstat(fsi, &st) == -1)
fatal("%s: %s", special, strerror(errno));
if (!mfs) {
if (S_ISBLK(st.st_mode))
@@ -496,7 +496,7 @@ havelabel:
if (mfs) {
if (realpath(argv[1], node) == NULL)
err(1, "realpath %s", argv[1]);
- if (stat(node, &mountpoint) < 0)
+ if (stat(node, &mountpoint) == -1)
err(ECANCELED, "stat %s", node);
mfsuid = mountpoint.st_uid;
mfsgid = mountpoint.st_gid;
@@ -555,10 +555,10 @@ havelabel:
args.fspec = mountfromname;
if (pop != NULL) {
int tmpflags = mntflags & ~MNT_RDONLY;
- if (mount(MOUNT_MFS, tmpnode, tmpflags, &args) < 0)
+ if (mount(MOUNT_MFS, tmpnode, tmpflags, &args) == -1)
exit(errno); /* parent prints message */
}
- if (mount(MOUNT_MFS, node, mntflags, &args) < 0)
+ if (mount(MOUNT_MFS, node, mntflags, &args) == -1)
exit(errno); /* parent prints message */
}
#endif
@@ -570,7 +570,7 @@ getdisklabel(char *s, int fd)
{
static struct disklabel lab;
- if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) {
if (disktype != NULL) {
struct disklabel *lp;
@@ -595,7 +595,7 @@ rewritelabel(char *s, int fd, struct disklabel *lp)
lp->d_checksum = 0;
lp->d_checksum = dkcksum(lp);
- if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) {
+ if (ioctl(fd, DIOCWDINFO, (char *)lp) == -1) {
warn("ioctl (WDINFO)");
fatal("%s: can't rewrite disk label", s);
}
@@ -607,7 +607,7 @@ fatal(const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
- if (fcntl(STDERR_FILENO, F_GETFL) < 0) {
+ if (fcntl(STDERR_FILENO, F_GETFL) == -1) {
openlog(__progname, LOG_CONS, LOG_DAEMON);
vsyslog(LOG_ERR, fmt, ap);
closelog();
@@ -669,7 +669,7 @@ waitformount(char *node, pid_t pid)
* can mount a filesystem which hides our
* ramdisk before we see the success.
*/
- if (statfs(node, &sf) < 0)
+ if (statfs(node, &sf) == -1)
err(ECANCELED, "statfs %s", node);
if (!strcmp(sf.f_mntfromname, mountfromname) &&
!strncmp(sf.f_mntonname, node,
diff --git a/sbin/newfs_ext2fs/newfs_ext2fs.c b/sbin/newfs_ext2fs/newfs_ext2fs.c
index 815e4942553..a22423490ae 100644
--- a/sbin/newfs_ext2fs/newfs_ext2fs.c
+++ b/sbin/newfs_ext2fs/newfs_ext2fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: newfs_ext2fs.c,v 1.26 2018/11/25 17:12:10 krw Exp $ */
+/* $OpenBSD: newfs_ext2fs.c,v 1.27 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: newfs_ext2fs.c,v 1.8 2009/03/02 10:38:13 tsutsui Exp $ */
/*
@@ -248,7 +248,7 @@ main(int argc, char *argv[])
err(EXIT_FAILURE, "can't fstat opened %s", special);
} else { /* !Fflag */
fd = opendev(special, fl, 0, &special);
- if (fd < 0 || fstat(fd, &sb) == -1)
+ if (fd == -1 || fstat(fd, &sb) == -1)
err(EXIT_FAILURE, "%s: open", special);
if (!Nflag) {
@@ -464,7 +464,7 @@ getdisklabel(const char *s, int fd)
{
static struct disklabel lab;
- if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) {
+ if (ioctl(fd, DIOCGDINFO, (char *)&lab) == -1) {
if (disktype != NULL) {
struct disklabel *lp;
@@ -491,7 +491,7 @@ getpartition(int fsi, const char *special, char *argv[], struct disklabel **dl)
struct disklabel *lp;
struct partition *pp;
- if (fstat(fsi, &st) < 0)
+ if (fstat(fsi, &st) == -1)
err(EXIT_FAILURE, "%s", special);
if (S_ISBLK(st.st_mode))
errx(EXIT_FAILURE, "%s: block device", special);
diff --git a/sbin/nfsd/nfsd.c b/sbin/nfsd/nfsd.c
index 41448a2a301..56c3c04a8d2 100644
--- a/sbin/nfsd/nfsd.c
+++ b/sbin/nfsd/nfsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsd.c,v 1.38 2018/01/05 08:13:31 mpi Exp $ */
+/* $OpenBSD: nfsd.c,v 1.39 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */
/*
@@ -197,7 +197,7 @@ main(int argc, char *argv[])
setproctitle("server");
nsd.nsd_nfsd = NULL;
- if (nfssvc(NFSSVC_NFSD, &nsd) < 0) {
+ if (nfssvc(NFSSVC_NFSD, &nsd) == -1) {
syslog(LOG_ERR, "nfssvc: %s", strerror(errno));
return (1);
}
@@ -206,7 +206,7 @@ main(int argc, char *argv[])
/* If we are serving udp, set up the socket. */
if (udpflag) {
- if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
syslog(LOG_ERR, "can't create udp socket");
return (1);
}
@@ -216,7 +216,7 @@ main(int argc, char *argv[])
inetaddr.sin_port = htons(NFS_PORT);
inetaddr.sin_len = sizeof(inetaddr);
if (bind(sock, (struct sockaddr *)&inetaddr,
- sizeof(inetaddr)) < 0) {
+ sizeof(inetaddr)) == -1) {
syslog(LOG_ERR, "can't bind udp addr");
return (1);
}
@@ -228,7 +228,7 @@ main(int argc, char *argv[])
nfsdargs.sock = sock;
nfsdargs.name = NULL;
nfsdargs.namelen = 0;
- if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
+ if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) == -1) {
syslog(LOG_ERR, "can't Add UDP socket");
return (1);
}
@@ -239,12 +239,12 @@ main(int argc, char *argv[])
on = 1;
connect_type_cnt = 0;
if (tcpflag) {
- if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
syslog(LOG_ERR, "can't create tcp socket");
return (1);
}
if (setsockopt(tcpsock,
- SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
+ SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1)
syslog(LOG_ERR, "setsockopt SO_REUSEADDR: %s", strerror(errno));
memset(&inetaddr, 0, sizeof inetaddr);
inetaddr.sin_family = AF_INET;
@@ -252,11 +252,11 @@ main(int argc, char *argv[])
inetaddr.sin_port = htons(NFS_PORT);
inetaddr.sin_len = sizeof(inetaddr);
if (bind(tcpsock, (struct sockaddr *)&inetaddr,
- sizeof (inetaddr)) < 0) {
+ sizeof (inetaddr)) == -1) {
syslog(LOG_ERR, "can't bind tcp addr");
return (1);
}
- if (listen(tcpsock, 5) < 0) {
+ if (listen(tcpsock, 5) == -1) {
syslog(LOG_ERR, "listen failed");
return (1);
}
@@ -298,7 +298,7 @@ main(int argc, char *argv[])
if (tcpflag) {
len = sizeof(inetpeer);
if ((msgsock = accept(tcpsock,
- (struct sockaddr *)&inetpeer, &len)) < 0) {
+ (struct sockaddr *)&inetpeer, &len)) == -1) {
if (errno == EWOULDBLOCK || errno == EINTR ||
errno == ECONNABORTED)
continue;
@@ -307,13 +307,13 @@ main(int argc, char *argv[])
}
memset(inetpeer.sin_zero, 0, sizeof(inetpeer.sin_zero));
if (setsockopt(msgsock, SOL_SOCKET,
- SO_KEEPALIVE, &on, sizeof(on)) < 0)
+ SO_KEEPALIVE, &on, sizeof(on)) == -1)
syslog(LOG_ERR,
"setsockopt SO_KEEPALIVE: %s", strerror(errno));
nfsdargs.sock = msgsock;
nfsdargs.name = (caddr_t)&inetpeer;
nfsdargs.namelen = sizeof(inetpeer);
- if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) < 0) {
+ if (nfssvc(NFSSVC_ADDSOCK, &nfsdargs) == -1) {
syslog(LOG_ERR, "can't Add TCP socket");
return (1);
}
diff --git a/sbin/nologin/nologin.c b/sbin/nologin/nologin.c
index 15875cc1b0e..88bdd5f6fd7 100644
--- a/sbin/nologin/nologin.c
+++ b/sbin/nologin/nologin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nologin.c,v 1.7 2018/08/14 18:13:11 cheloha Exp $ */
+/* $OpenBSD: nologin.c,v 1.8 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 1997, Jason Downs. All rights reserved.
@@ -52,7 +52,7 @@ main(int argc, char *argv[])
err(1, "pledge");
nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
- if (nfd < 0) {
+ if (nfd == -1) {
write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
exit (1);
}
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index f56f6f9e90b..5dbf64284b2 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl.c,v 1.373 2019/04/15 21:36:44 sashan Exp $ */
+/* $OpenBSD: pfctl.c,v 1.374 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -254,7 +254,7 @@ usage(void)
int
pfctl_enable(int dev, int opts)
{
- if (ioctl(dev, DIOCSTART)) {
+ if (ioctl(dev, DIOCSTART) == -1) {
if (errno == EEXIST)
errx(1, "pf already enabled");
else
@@ -269,7 +269,7 @@ pfctl_enable(int dev, int opts)
int
pfctl_disable(int dev, int opts)
{
- if (ioctl(dev, DIOCSTOP)) {
+ if (ioctl(dev, DIOCSTOP) == -1) {
if (errno == ENOENT)
errx(1, "pf not enabled");
else
@@ -291,7 +291,7 @@ pfctl_clear_stats(int dev, const char *iface, int opts)
sizeof(pi.pfiio_name)) >= sizeof(pi.pfiio_name))
errx(1, "invalid interface: %s", iface);
- if (ioctl(dev, DIOCCLRSTATUS, &pi))
+ if (ioctl(dev, DIOCCLRSTATUS, &pi) == -1)
err(1, "DIOCCLRSTATUS");
if ((opts & PF_OPT_QUIET) == 0) {
fprintf(stderr, "pf: statistics cleared");
@@ -310,7 +310,7 @@ pfctl_clear_interface_flags(int dev, int opts)
bzero(&pi, sizeof(pi));
pi.pfiio_flags = PFI_IFLAG_SKIP;
- if (ioctl(dev, DIOCCLRIFFLAG, &pi))
+ if (ioctl(dev, DIOCCLRIFFLAG, &pi) == -1)
err(1, "DIOCCLRIFFLAG");
if ((opts & PF_OPT_QUIET) == 0)
fprintf(stderr, "pf: interface flags reset\n");
@@ -335,7 +335,7 @@ pfctl_clear_rules(int dev, int opts, char *anchorname)
void
pfctl_clear_src_nodes(int dev, int opts)
{
- if (ioctl(dev, DIOCCLRSRCNODES))
+ if (ioctl(dev, DIOCCLRSRCNODES) == -1)
err(1, "DIOCCLRSRCNODES");
if ((opts & PF_OPT_QUIET) == 0)
fprintf(stderr, "source tracking entries cleared\n");
@@ -351,7 +351,7 @@ pfctl_clear_states(int dev, const char *iface, int opts)
sizeof(psk.psk_ifname)) >= sizeof(psk.psk_ifname))
errx(1, "invalid interface: %s", iface);
- if (ioctl(dev, DIOCCLRSTATES, &psk))
+ if (ioctl(dev, DIOCCLRSTATES, &psk) == -1)
err(1, "DIOCCLRSTATES");
if ((opts & PF_OPT_QUIET) == 0)
fprintf(stderr, "%d states cleared\n", psk.psk_killed);
@@ -466,13 +466,13 @@ pfctl_kill_src_nodes(int dev, int opts)
copy_satopfaddr(&psnk.psnk_src.addr.v.a.addr,
resp[1]->ai_addr);
- if (ioctl(dev, DIOCKILLSRCNODES, &psnk))
+ if (ioctl(dev, DIOCKILLSRCNODES, &psnk) == -1)
err(1, "DIOCKILLSRCNODES");
killed += psnk.psnk_killed;
}
freeaddrinfo(res[1]);
} else {
- if (ioctl(dev, DIOCKILLSRCNODES, &psnk))
+ if (ioctl(dev, DIOCKILLSRCNODES, &psnk) == -1)
err(1, "DIOCKILLSRCNODES");
killed += psnk.psnk_killed;
}
@@ -547,13 +547,13 @@ pfctl_net_kill_states(int dev, const char *iface, int opts, int rdomain)
copy_satopfaddr(&psk.psk_src.addr.v.a.addr,
resp[1]->ai_addr);
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
err(1, "DIOCKILLSTATES");
killed += psk.psk_killed;
}
freeaddrinfo(res[1]);
} else {
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
err(1, "DIOCKILLSTATES");
killed += psk.psk_killed;
}
@@ -586,7 +586,7 @@ pfctl_label_kill_states(int dev, const char *iface, int opts, int rdomain)
psk.psk_rdomain = rdomain;
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
err(1, "DIOCKILLSTATES");
if ((opts & PF_OPT_QUIET) == 0)
@@ -619,7 +619,7 @@ pfctl_id_kill_states(int dev, int opts)
}
psk.psk_pfcmp.id = htobe64(psk.psk_pfcmp.id);
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
err(1, "DIOCKILLSTATES");
if ((opts & PF_OPT_QUIET) == 0)
@@ -678,7 +678,7 @@ pfctl_key_kill_states(int dev, const char *iface, int opts, int rdomain)
if (pfctl_parse_host(tokens[didx], &psk.psk_dst) == -1)
errx(1, "invalid host: %s", tokens[didx]);
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
err(1, "DIOCKILLSTATES");
if ((opts & PF_OPT_QUIET) == 0)
@@ -813,7 +813,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
memcpy(pr.anchor, npath, sizeof(pr.anchor));
if (opts & PF_OPT_SHOWALL) {
pr.rule.action = PF_PASS;
- if (ioctl(dev, DIOCGETRULES, &pr)) {
+ if (ioctl(dev, DIOCGETRULES, &pr) == -1) {
warn("DIOCGETRULES");
ret = -1;
goto error;
@@ -828,7 +828,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
pr.action = PF_GET_CLR_CNTR;
pr.rule.action = PF_PASS;
- if (ioctl(dev, DIOCGETRULES, &pr)) {
+ if (ioctl(dev, DIOCGETRULES, &pr) == -1) {
warn("DIOCGETRULES");
ret = -1;
goto error;
@@ -847,7 +847,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
}
for (; nr < mnr; ++nr) {
pr.nr = nr;
- if (ioctl(dev, DIOCGETRULE, &pr)) {
+ if (ioctl(dev, DIOCGETRULE, &pr) == -1) {
warn("DIOCGETRULE");
ret = -1;
goto error;
@@ -918,7 +918,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
memset(&prs, 0, sizeof(prs));
memcpy(prs.path, npath, sizeof(prs.path));
- if (ioctl(dev, DIOCGETRULESETS, &prs)) {
+ if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) {
if (errno == EINVAL)
fprintf(stderr, "Anchor '%s' "
"not found.\n", anchorname);
@@ -929,7 +929,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format,
for (nr = 0; nr < mnr; ++nr) {
prs.nr = nr;
- if (ioctl(dev, DIOCGETRULESET, &prs))
+ if (ioctl(dev, DIOCGETRULESET, &prs) == -1)
err(1, "DIOCGETRULESET");
INDENT(depth, !(opts & PF_OPT_VERBOSE));
printf("anchor \"%s\" all {\n", prs.name);
@@ -966,7 +966,7 @@ pfctl_show_src_nodes(int dev, int opts)
err(1, "realloc");
psn.psn_buf = inbuf = newinbuf;
}
- if (ioctl(dev, DIOCGETSRCNODES, &psn) < 0) {
+ if (ioctl(dev, DIOCGETSRCNODES, &psn) == -1) {
warn("DIOCGETSRCNODES");
free(inbuf);
return (-1);
@@ -1011,7 +1011,7 @@ pfctl_show_states(int dev, const char *iface, int opts, long shownr)
err(1, "realloc");
ps.ps_buf = inbuf = newinbuf;
}
- if (ioctl(dev, DIOCGETSTATES, &ps) < 0) {
+ if (ioctl(dev, DIOCGETSTATES, &ps) == -1) {
warn("DIOCGETSTATES");
free(inbuf);
return (-1);
@@ -1049,11 +1049,11 @@ pfctl_show_status(int dev, int opts)
struct pfctl_watermarks wats;
struct pfioc_synflwats iocwats;
- if (ioctl(dev, DIOCGETSTATUS, &status)) {
+ if (ioctl(dev, DIOCGETSTATUS, &status) == -1) {
warn("DIOCGETSTATUS");
return (-1);
}
- if (ioctl(dev, DIOCGETSYNFLWATS, &iocwats)) {
+ if (ioctl(dev, DIOCGETSYNFLWATS, &iocwats) == -1) {
warn("DIOCGETSYNFLWATS");
return (-1);
}
@@ -1076,7 +1076,7 @@ pfctl_show_timeouts(int dev, int opts)
memset(&pt, 0, sizeof(pt));
for (i = 0; pf_timeouts[i].name; i++) {
pt.timeout = pf_timeouts[i].timeout;
- if (ioctl(dev, DIOCGETTIMEOUT, &pt))
+ if (ioctl(dev, DIOCGETTIMEOUT, &pt) == -1)
err(1, "DIOCGETTIMEOUT");
printf("%-20s %10d", pf_timeouts[i].name, pt.seconds);
if (pf_timeouts[i].timeout >= PFTM_ADAPTIVE_START &&
@@ -1101,7 +1101,7 @@ pfctl_show_limits(int dev, int opts)
memset(&pl, 0, sizeof(pl));
for (i = 0; pf_limits[i].name; i++) {
pl.index = pf_limits[i].index;
- if (ioctl(dev, DIOCGETLIMIT, &pl))
+ if (ioctl(dev, DIOCGETLIMIT, &pl) == -1)
err(1, "DIOCGETLIMIT");
printf("%-13s ", pf_limits[i].name);
if (pl.limit == UINT_MAX)
@@ -1246,7 +1246,7 @@ pfctl_load_queue(struct pfctl *pf, u_int32_t ticket, struct pfctl_qsitem *qi)
q.ticket = ticket;
bcopy(&qi->qs, &q.queue, sizeof(q.queue));
if ((pf->opts & PF_OPT_NOACTION) == 0)
- if (ioctl(pf->dev, DIOCADDQUEUE, &q))
+ if (ioctl(pf->dev, DIOCADDQUEUE, &q) == -1)
err(1, "DIOCADDQUEUE");
if (pf->opts & PF_OPT_VERBOSE)
print_queuespec(&qi->qs);
@@ -1466,7 +1466,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth)
if (r->anchor && strlcpy(pr.anchor_call, name,
sizeof(pr.anchor_call)) >= sizeof(pr.anchor_call))
errx(1, "pfctl_load_rule: strlcpy");
- if (ioctl(pf->dev, DIOCADDRULE, &pr))
+ if (ioctl(pf->dev, DIOCADDRULE, &pr) == -1)
err(1, "DIOCADDRULE");
}
@@ -1623,7 +1623,7 @@ pfctl_fopen(const char *name, const char *mode)
fp = fopen(name, mode);
if (fp == NULL)
return (NULL);
- if (fstat(fileno(fp), &st)) {
+ if (fstat(fileno(fp), &st) == -1) {
fclose(fp);
return (NULL);
}
@@ -1751,7 +1751,7 @@ pfctl_load_options(struct pfctl *pf)
else {
memset(&pl, 0, sizeof(pl));
pl.index = pf_limits[PF_LIMIT_STATES].index;
- if (ioctl(dev, DIOCGETLIMIT, &pl))
+ if (ioctl(dev, DIOCGETLIMIT, &pl) == -1)
err(1, "DIOCGETLIMIT");
curlim = pl.limit;
}
@@ -1794,7 +1794,7 @@ pfctl_load_limit(struct pfctl *pf, unsigned int index, unsigned int limit)
memset(&pl, 0, sizeof(pl));
pl.index = index;
pl.limit = limit;
- if (ioctl(pf->dev, DIOCSETLIMIT, &pl)) {
+ if (ioctl(pf->dev, DIOCSETLIMIT, &pl) == -1) {
if (errno == EBUSY)
warnx("Current pool size exceeds requested %s limit %u",
pf_limits[index].name, limit);
@@ -1839,7 +1839,7 @@ pfctl_load_timeout(struct pfctl *pf, unsigned int timeout, unsigned int seconds)
memset(&pt, 0, sizeof(pt));
pt.timeout = timeout;
pt.seconds = seconds;
- if (ioctl(pf->dev, DIOCSETTIMEOUT, &pt)) {
+ if (ioctl(pf->dev, DIOCSETTIMEOUT, &pt) == -1) {
warnx("DIOCSETTIMEOUT");
return (1);
}
@@ -1855,7 +1855,7 @@ pfctl_set_synflwats(struct pfctl *pf, u_int32_t lowat, u_int32_t hiwat)
ps.hiwat = hiwat;
ps.lowat = lowat;
- if (ioctl(pf->dev, DIOCSETSYNFLWATS, &ps)) {
+ if (ioctl(pf->dev, DIOCSETSYNFLWATS, &ps) == -1) {
warnx("Cannot set synflood detection watermarks");
return (1);
}
@@ -1982,7 +1982,7 @@ pfctl_load_logif(struct pfctl *pf, char *ifname)
warnx("pfctl_load_logif: strlcpy");
return (1);
}
- if (ioctl(pf->dev, DIOCSETSTATUSIF, &pi)) {
+ if (ioctl(pf->dev, DIOCSETSTATUSIF, &pi) == -1) {
warnx("DIOCSETSTATUSIF");
return (1);
}
@@ -2004,7 +2004,7 @@ pfctl_set_hostid(struct pfctl *pf, u_int32_t hostid)
int
pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid)
{
- if (ioctl(dev, DIOCSETHOSTID, &hostid)) {
+ if (ioctl(dev, DIOCSETHOSTID, &hostid) == -1) {
warnx("DIOCSETHOSTID");
return (1);
}
@@ -2014,7 +2014,7 @@ pfctl_load_hostid(struct pfctl *pf, u_int32_t hostid)
int
pfctl_load_reassembly(struct pfctl *pf, u_int32_t reassembly)
{
- if (ioctl(dev, DIOCSETREASS, &reassembly)) {
+ if (ioctl(dev, DIOCSETREASS, &reassembly) == -1) {
warnx("DIOCSETREASS");
return (1);
}
@@ -2024,7 +2024,7 @@ pfctl_load_reassembly(struct pfctl *pf, u_int32_t reassembly)
int
pfctl_load_syncookies(struct pfctl *pf, u_int8_t val)
{
- if (ioctl(dev, DIOCSETSYNCOOKIES, &val)) {
+ if (ioctl(dev, DIOCSETSYNCOOKIES, &val) == -1) {
warnx("DIOCSETSYNCOOKIES");
return (1);
}
@@ -2047,7 +2047,7 @@ pfctl_set_debug(struct pfctl *pf, char *d)
pf->debug_set = 1;
if ((pf->opts & PF_OPT_NOACTION) == 0)
- if (ioctl(dev, DIOCSETDEBUG, &level))
+ if (ioctl(dev, DIOCSETDEBUG, &level) == -1)
err(1, "DIOCSETDEBUG");
if (pf->opts & PF_OPT_VERBOSE)
@@ -2059,7 +2059,7 @@ pfctl_set_debug(struct pfctl *pf, char *d)
int
pfctl_load_debug(struct pfctl *pf, unsigned int level)
{
- if (ioctl(pf->dev, DIOCSETDEBUG, &level)) {
+ if (ioctl(pf->dev, DIOCSETDEBUG, &level) == -1) {
warnx("DIOCSETDEBUG");
return (1);
}
@@ -2081,10 +2081,10 @@ pfctl_set_interface_flags(struct pfctl *pf, char *ifname, int flags, int how)
if ((pf->opts & PF_OPT_NOACTION) == 0) {
if (how == 0) {
- if (ioctl(pf->dev, DIOCCLRIFFLAG, &pi))
+ if (ioctl(pf->dev, DIOCCLRIFFLAG, &pi) == -1)
err(1, "DIOCCLRIFFLAG");
} else {
- if (ioctl(pf->dev, DIOCSETIFFLAG, &pi))
+ if (ioctl(pf->dev, DIOCSETIFFLAG, &pi) == -1)
err(1, "DIOCSETIFFLAG");
}
}
@@ -2099,7 +2099,7 @@ pfctl_debug(int dev, u_int32_t level, int opts)
memset(&t, 0, sizeof(t));
t.pfrb_type = PFRB_TRANS;
if (pfctl_trans(dev, &t, DIOCXBEGIN, 0) ||
- ioctl(dev, DIOCSETDEBUG, &level) ||
+ ioctl(dev, DIOCSETDEBUG, &level) == -1||
pfctl_trans(dev, &t, DIOCXCOMMIT, 0))
err(1, "pfctl_debug ioctl");
@@ -2116,7 +2116,7 @@ pfctl_show_anchors(int dev, int opts, char *anchorname)
memset(&pr, 0, sizeof(pr));
memcpy(pr.path, anchorname, sizeof(pr.path));
- if (ioctl(dev, DIOCGETRULESETS, &pr)) {
+ if (ioctl(dev, DIOCGETRULESETS, &pr) == -1) {
if (errno == EINVAL)
fprintf(stderr, "Anchor '%s' not found.\n",
anchorname);
@@ -2129,7 +2129,7 @@ pfctl_show_anchors(int dev, int opts, char *anchorname)
char sub[PATH_MAX];
pr.nr = nr;
- if (ioctl(dev, DIOCGETRULESET, &pr))
+ if (ioctl(dev, DIOCGETRULESET, &pr) == -1)
err(1, "DIOCGETRULESET");
if (!strcmp(pr.name, PF_RESERVED_ANCHOR))
continue;
@@ -2186,7 +2186,7 @@ pfctl_state_store(int dev, const char *file)
err(1, "realloc");
ps.ps_buf = inbuf = newinbuf;
}
- if (ioctl(dev, DIOCGETSTATES, &ps) < 0)
+ if (ioctl(dev, DIOCGETSTATES, &ps) == -1)
err(1, "DIOCGETSTATES");
if (ps.ps_len + sizeof(struct pfioc_states) < len)
@@ -2220,7 +2220,7 @@ pfctl_state_load(int dev, const char *file)
err(1, "open: %s", file);
while (fread(&ps.state, sizeof(ps.state), 1, f) == 1) {
- if (ioctl(dev, DIOCADDSTATE, &ps) < 0) {
+ if (ioctl(dev, DIOCADDSTATE, &ps) == -1) {
switch (errno) {
case EEXIST:
case EINVAL:
diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c
index 3a0a334010e..9560f367898 100644
--- a/sbin/pfctl/pfctl_optimize.c
+++ b/sbin/pfctl/pfctl_optimize.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_optimize.c,v 1.41 2019/03/07 08:01:52 kn Exp $ */
+/* $OpenBSD: pfctl_optimize.c,v 1.42 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2004 Mike Frantzen <frantzen@openbsd.org>
@@ -869,7 +869,7 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks)
memset(&pr, 0, sizeof(pr));
pr.rule.action = PF_PASS;
- if (ioctl(pf->dev, DIOCGETRULES, &pr)) {
+ if (ioctl(pf->dev, DIOCGETRULES, &pr) == -1) {
warn("DIOCGETRULES");
return (1);
}
@@ -883,7 +883,7 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks)
return (1);
}
pr.nr = nr;
- if (ioctl(pf->dev, DIOCGETRULE, &pr)) {
+ if (ioctl(pf->dev, DIOCGETRULE, &pr) == -1) {
warn("DIOCGETRULES");
free(por);
return (1);
diff --git a/sbin/pfctl/pfctl_osfp.c b/sbin/pfctl/pfctl_osfp.c
index 9c51d7462eb..79abfd1a7ab 100644
--- a/sbin/pfctl/pfctl_osfp.c
+++ b/sbin/pfctl/pfctl_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_osfp.c,v 1.25 2017/05/28 07:17:53 akfaew Exp $ */
+/* $OpenBSD: pfctl_osfp.c,v 1.26 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@openbsd.org>
@@ -259,7 +259,7 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename)
void
pfctl_clear_fingerprints(int dev, int opts)
{
- if (ioctl(dev, DIOCOSFPFLUSH))
+ if (ioctl(dev, DIOCOSFPFLUSH) == -1)
err(1, "DIOCOSFPFLUSH");
}
@@ -290,7 +290,7 @@ pfctl_load_fingerprints(int dev, int opts)
for (i = 0; i >= 0; i++) {
memset(&io, 0, sizeof(io));
io.fp_getnum = i;
- if (ioctl(dev, DIOCOSFPGET, &io)) {
+ if (ioctl(dev, DIOCOSFPGET, &io) == -1) {
if (errno == EBUSY)
break;
warn("DIOCOSFPGET");
@@ -625,7 +625,7 @@ add_fingerprint(int dev, int opts, struct pf_osfp_ioctl *fp)
/* Linked to the sys/net/pf_osfp.c. Call pf_osfp_add() */
if ((errno = pf_osfp_add(fp)))
#else
- if ((opts & PF_OPT_NOACTION) == 0 && ioctl(dev, DIOCOSFPADD, fp))
+ if ((opts & PF_OPT_NOACTION) == 0 && ioctl(dev, DIOCOSFPADD, fp) == -1)
#endif /* FAKE_PF_KERNEL */
{
if (errno == EEXIST) {
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 351e7802d0f..c80f66f2587 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_parser.c,v 1.340 2019/03/30 02:45:14 kn Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.341 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1350,7 +1350,7 @@ ifa_load(void)
struct ifaddrs *ifap, *ifa;
struct node_host *n = NULL, *h = NULL;
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
err(1, "getifaddrs");
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
diff --git a/sbin/pfctl/pfctl_queue.c b/sbin/pfctl/pfctl_queue.c
index 2b686defce7..399f0f75a1d 100644
--- a/sbin/pfctl/pfctl_queue.c
+++ b/sbin/pfctl/pfctl_queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_queue.c,v 1.6 2017/07/19 12:51:30 mikeb Exp $ */
+/* $OpenBSD: pfctl_queue.c,v 1.7 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2003 - 2013 Henning Brauer <henning@openbsd.org>
@@ -123,7 +123,7 @@ pfctl_update_qstats(int dev)
memset(&pq, 0, sizeof(pq));
memset(&pqs, 0, sizeof(pqs));
memset(&qstats, 0, sizeof(qstats));
- if (ioctl(dev, DIOCGETQUEUES, &pq)) {
+ if (ioctl(dev, DIOCGETQUEUES, &pq) == -1) {
warn("DIOCGETQUEUES");
return (-1);
}
@@ -140,7 +140,7 @@ pfctl_update_qstats(int dev)
pqs.ticket = pq.ticket;
pqs.buf = &qstats.data;
pqs.nbytes = sizeof(qstats.data);
- if (ioctl(dev, DIOCGETQSTATS, &pqs)) {
+ if (ioctl(dev, DIOCGETQSTATS, &pqs) == -1) {
warn("DIOCGETQSTATS");
return (-1);
}
diff --git a/sbin/pfctl/pfctl_radix.c b/sbin/pfctl/pfctl_radix.c
index 632e3939121..408148a88da 100644
--- a/sbin/pfctl/pfctl_radix.c
+++ b/sbin/pfctl/pfctl_radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_radix.c,v 1.34 2017/08/11 22:30:38 benno Exp $ */
+/* $OpenBSD: pfctl_radix.c,v 1.35 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -65,7 +65,7 @@ pfr_clr_tables(struct pfr_table *filter, int *ndel, int flags)
io.pfrio_flags = flags;
if (filter != NULL)
io.pfrio_table = *filter;
- if (ioctl(dev, DIOCRCLRTABLES, &io))
+ if (ioctl(dev, DIOCRCLRTABLES, &io) == -1)
return (-1);
if (ndel != NULL)
*ndel = io.pfrio_ndel;
@@ -86,7 +86,7 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags)
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRADDTABLES, &io))
+ if (ioctl(dev, DIOCRADDTABLES, &io) == -1)
return (-1);
if (nadd != NULL)
*nadd = io.pfrio_nadd;
@@ -107,7 +107,7 @@ pfr_del_tables(struct pfr_table *tbl, int size, int *ndel, int flags)
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRDELTABLES, &io))
+ if (ioctl(dev, DIOCRDELTABLES, &io) == -1)
return (-1);
if (ndel != NULL)
*ndel = io.pfrio_ndel;
@@ -131,7 +131,7 @@ pfr_get_tables(struct pfr_table *filter, struct pfr_table *tbl, int *size,
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = *size;
- if (ioctl(dev, DIOCRGETTABLES, &io))
+ if (ioctl(dev, DIOCRGETTABLES, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -154,7 +154,7 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size,
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = *size;
- if (ioctl(dev, DIOCRGETTSTATS, &io))
+ if (ioctl(dev, DIOCRGETTSTATS, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -172,7 +172,7 @@ pfr_clr_addrs(struct pfr_table *tbl, int *ndel, int flags)
bzero(&io, sizeof io);
io.pfrio_flags = flags;
io.pfrio_table = *tbl;
- if (ioctl(dev, DIOCRCLRADDRS, &io))
+ if (ioctl(dev, DIOCRCLRADDRS, &io) == -1)
return (-1);
if (ndel != NULL)
*ndel = io.pfrio_ndel;
@@ -195,7 +195,7 @@ pfr_add_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRADDADDRS, &io))
+ if (ioctl(dev, DIOCRADDADDRS, &io) == -1)
return (-1);
if (nadd != NULL)
*nadd = io.pfrio_nadd;
@@ -218,7 +218,7 @@ pfr_del_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRDELADDRS, &io))
+ if (ioctl(dev, DIOCRDELADDRS, &io) == -1)
return (-1);
if (ndel != NULL)
*ndel = io.pfrio_ndel;
@@ -242,7 +242,7 @@ pfr_set_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
io.pfrio_size2 = (size2 != NULL) ? *size2 : 0;
- if (ioctl(dev, DIOCRSETADDRS, &io))
+ if (ioctl(dev, DIOCRSETADDRS, &io) == -1)
return (-1);
if (nadd != NULL)
*nadd = io.pfrio_nadd;
@@ -272,7 +272,7 @@ pfr_get_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int *size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = *size;
- if (ioctl(dev, DIOCRGETADDRS, &io))
+ if (ioctl(dev, DIOCRGETADDRS, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -295,7 +295,7 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = *size;
- if (ioctl(dev, DIOCRGETASTATS, &io))
+ if (ioctl(dev, DIOCRGETASTATS, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -315,7 +315,7 @@ pfr_clr_tstats(struct pfr_table *tbl, int size, int *nzero, int flags)
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRCLRTSTATS, &io))
+ if (ioctl(dev, DIOCRCLRTSTATS, &io) == -1)
return (-1);
if (nzero)
*nzero = io.pfrio_nzero;
@@ -338,7 +338,7 @@ pfr_tst_addrs(struct pfr_table *tbl, struct pfr_addr *addr, int size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
- if (ioctl(dev, DIOCRTSTADDRS, &io))
+ if (ioctl(dev, DIOCRTSTADDRS, &io) == -1)
return (-1);
if (nmatch)
*nmatch = io.pfrio_nmatch;
@@ -362,7 +362,7 @@ pfr_ina_define(struct pfr_table *tbl, struct pfr_addr *addr, int size,
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = size;
io.pfrio_ticket = ticket;
- if (ioctl(dev, DIOCRINADEFINE, &io))
+ if (ioctl(dev, DIOCRINADEFINE, &io) == -1)
return (-1);
if (nadd != NULL)
*nadd = io.pfrio_nadd;
@@ -392,7 +392,7 @@ pfi_get_ifaces(const char *filter, struct pfi_kif *buf, int *size)
io.pfiio_buffer = buf;
io.pfiio_esize = sizeof(*buf);
io.pfiio_size = *size;
- if (ioctl(dev, DIOCIGETIFACES, &io))
+ if (ioctl(dev, DIOCIGETIFACES, &io) == -1)
return (-1);
*size = io.pfiio_size;
return (0);
diff --git a/sbin/pflogd/pflogd.c b/sbin/pflogd/pflogd.c
index e855bab910f..b8a8c8ae544 100644
--- a/sbin/pflogd/pflogd.c
+++ b/sbin/pflogd/pflogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pflogd.c,v 1.59 2018/08/26 18:24:46 brynet Exp $ */
+/* $OpenBSD: pflogd.c,v 1.60 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2001 Theo de Raadt
@@ -213,7 +213,7 @@ init_pcap(void)
set_pcap_filter();
/* lock */
- if (ioctl(pcap_fileno(hpcap), BIOCLOCK) < 0) {
+ if (ioctl(pcap_fileno(hpcap), BIOCLOCK) == -1) {
logmsg(LOG_ERR, "BIOCLOCK: %s", strerror(errno));
return (-1);
}
diff --git a/sbin/pflogd/privsep.c b/sbin/pflogd/privsep.c
index c0549727356..36cc0395f1d 100644
--- a/sbin/pflogd/privsep.c
+++ b/sbin/pflogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.32 2018/08/26 18:26:51 brynet Exp $ */
+/* $OpenBSD: privsep.c,v 1.33 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -99,7 +99,7 @@ priv_init(int Pflag, int argc, char *argv[])
err(1, "socketpair() failed");
child_pid = fork();
- if (child_pid < 0)
+ if (child_pid == -1)
err(1, "fork() failed");
if (!child_pid) {
@@ -200,7 +200,7 @@ BROKEN if (pledge("stdio rpath wpath cpath sendfd proc bpf", NULL) == -1)
0600);
olderrno = errno;
send_fd(socks[0], bpfd);
- if (bpfd < 0)
+ if (bpfd == -1)
logmsg(LOG_NOTICE,
"[priv]: failed to open %s: %s",
filename, strerror(olderrno));
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index d8fb0812ce7..b1cb3febd2d 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ping.c,v 1.235 2019/03/19 23:27:49 tedu Exp $ */
+/* $OpenBSD: ping.c,v 1.236 2019/06/28 13:32:45 deraadt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -495,10 +495,10 @@ main(int argc, char *argv[])
if (!v6flag && IN_MULTICAST(ntohl(dst4.sin_addr.s_addr))) {
if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF,
- &from4.sin_addr, sizeof(from4.sin_addr)) < 0)
+ &from4.sin_addr, sizeof(from4.sin_addr)) == -1)
err(1, "setsockopt IP_MULTICAST_IF");
} else {
- if (bind(s, from, from->sa_len) < 0)
+ if (bind(s, from, from->sa_len) == -1)
err(1, "bind");
}
} else if (options & F_VERBOSE) {
@@ -509,7 +509,7 @@ main(int argc, char *argv[])
int dummy;
socklen_t len = dst->sa_len;
- if ((dummy = socket(dst->sa_family, SOCK_DGRAM, 0)) < 0)
+ if ((dummy = socket(dst->sa_family, SOCK_DGRAM, 0)) == -1)
err(1, "UDP socket");
memcpy(from, dst, dst->sa_len);
@@ -536,23 +536,23 @@ main(int argc, char *argv[])
if ((moptions & MULTICAST_NOLOOP) && setsockopt(dummy,
IPPROTO_IP, IP_MULTICAST_LOOP, &loop,
- sizeof(loop)) < 0)
+ sizeof(loop)) == -1)
err(1, "setsockopt IP_MULTICAST_LOOP");
if ((moptions & MULTICAST_TTL) && setsockopt(dummy,
IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
- sizeof(ttl)) < 0)
+ sizeof(ttl)) == -1)
err(1, "setsockopt IP_MULTICAST_TTL");
}
if (rtableid > 0 &&
setsockopt(dummy, SOL_SOCKET, SO_RTABLE, &rtableid,
- sizeof(rtableid)) < 0)
+ sizeof(rtableid)) == -1)
err(1, "setsockopt(SO_RTABLE)");
- if (connect(dummy, from, len) < 0)
+ if (connect(dummy, from, len) == -1)
err(1, "UDP connect");
- if (getsockname(dummy, from, &len) < 0)
+ if (getsockname(dummy, from, &len) == -1)
err(1, "getsockname");
close(dummy);
@@ -593,10 +593,10 @@ main(int argc, char *argv[])
* size of both the send and receive buffers...
*/
maxsizelen = sizeof maxsize;
- if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &maxsize, &maxsizelen) < 0)
+ if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &maxsize, &maxsizelen) == -1)
err(1, "getsockopt");
if (maxsize < packlen &&
- setsockopt(s, SOL_SOCKET, SO_SNDBUF, &packlen, sizeof(maxsize)) < 0)
+ setsockopt(s, SOL_SOCKET, SO_SNDBUF, &packlen, sizeof(maxsize)) == -1)
err(1, "setsockopt");
/*
@@ -606,7 +606,7 @@ main(int argc, char *argv[])
* /etc/ethers.
*/
while (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
- &bufspace, sizeof(bufspace)) < 0) {
+ &bufspace, sizeof(bufspace)) == -1) {
if ((bufspace -= 1024) <= 0)
err(1, "Cannot set the receive buffer size");
}
@@ -641,7 +641,7 @@ main(int argc, char *argv[])
if ((moptions & MULTICAST_NOLOOP) &&
setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- &loop, sizeof(loop)) < 0)
+ &loop, sizeof(loop)) == -1)
err(1, "setsockopt IPV6_MULTICAST_LOOP");
optval = IPV6_DEFHLIM;
@@ -664,7 +664,7 @@ main(int argc, char *argv[])
}
if (setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER,
- &filt, sizeof(filt)) < 0)
+ &filt, sizeof(filt)) == -1)
err(1, "setsockopt(ICMP6_FILTER)");
if (hoplimit != -1) {
@@ -683,23 +683,23 @@ main(int argc, char *argv[])
if (options & F_TOS) {
optval = tos;
if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS,
- &optval, sizeof(optval)) < 0)
+ &optval, sizeof(optval)) == -1)
err(1, "setsockopt(IPV6_TCLASS)");
}
if (df) {
optval = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_DONTFRAG,
- &optval, sizeof(optval)) < 0)
+ &optval, sizeof(optval)) == -1)
err(1, "setsockopt(IPV6_DONTFRAG)");
}
optval = 1;
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO,
- &optval, sizeof(optval)) < 0)
+ &optval, sizeof(optval)) == -1)
err(1, "setsockopt(IPV6_RECVPKTINFO)");
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPLIMIT,
- &optval, sizeof(optval)) < 0)
+ &optval, sizeof(optval)) == -1)
err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
} else {
u_char loop = 0;
@@ -719,7 +719,7 @@ main(int argc, char *argv[])
struct ip *ip = (struct ip *)outpackhdr;
if (setsockopt(s, IPPROTO_IP, IP_HDRINCL,
- &optval, sizeof(optval)) < 0)
+ &optval, sizeof(optval)) == -1)
err(1, "setsockopt(IP_HDRINCL)");
ip->ip_v = IPVERSION;
ip->ip_hl = sizeof(struct ip) >> 2;
@@ -745,17 +745,17 @@ main(int argc, char *argv[])
rspace[IPOPT_OLEN] = sizeof(rspace)-1;
rspace[IPOPT_OFFSET] = IPOPT_MINOFF;
if (setsockopt(s, IPPROTO_IP, IP_OPTIONS,
- rspace, sizeof(rspace)) < 0)
+ rspace, sizeof(rspace)) == -1)
err(1, "record route");
}
if ((moptions & MULTICAST_NOLOOP) &&
setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP,
- &loop, sizeof(loop)) < 0)
+ &loop, sizeof(loop)) == -1)
err(1, "setsockopt IP_MULTICAST_LOOP");
if ((moptions & MULTICAST_TTL) &&
setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL,
- &ttl, sizeof(ttl)) < 0)
+ &ttl, sizeof(ttl)) == -1)
err(1, "setsockopt IP_MULTICAST_TTL");
}
@@ -875,7 +875,7 @@ main(int argc, char *argv[])
m.msg_controllen = sizeof(cmsgbuf.buf);
cc = recvmsg(s, &m, 0);
- if (cc < 0) {
+ if (cc == -1) {
if (errno != EINTR) {
warn("recvmsg");
sleep(1);
@@ -1116,8 +1116,8 @@ pinger(int s)
i = sendmsg(s, &smsghdr, 0);
- if (i < 0 || i != cc) {
- if (i < 0)
+ if (i == -1 || i != cc) {
+ if (i == -1)
warn("sendmsg");
printf("ping: wrote %s %d chars, ret=%d\n", hostname, cc, i);
}
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c
index 11a388dd738..427b1282293 100644
--- a/sbin/quotacheck/quotacheck.c
+++ b/sbin/quotacheck/quotacheck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: quotacheck.c,v 1.40 2018/09/26 03:03:39 deraadt Exp $ */
+/* $OpenBSD: quotacheck.c,v 1.41 2019/06/28 13:32:45 deraadt Exp $ */
/* $NetBSD: quotacheck.c,v 1.12 1996/03/30 22:34:25 mark Exp $ */
/*
@@ -276,7 +276,7 @@ chkquota(const char *vfstype, const char *fsname, const char *mntpt,
warn("fork");
return 1;
case 0: /* child */
- if ((fi = opendev(fsname, O_RDONLY, 0, NULL)) < 0)
+ if ((fi = opendev(fsname, O_RDONLY, 0, NULL)) == -1)
err(1, "%s", fsname);
sync();
for (i = 0; sblock_try[i] != -1; i++) {
@@ -377,7 +377,7 @@ chkquota(const char *vfstype, const char *fsname, const char *mntpt,
*pidp = pid;
return 0;
}
- if (waitpid(pid, &status, 0) < 0) {
+ if (waitpid(pid, &status, 0) == -1) {
warn("waitpid");
return 1;
}
@@ -428,7 +428,7 @@ update(const char *fsname, const char *quotafile, int type)
(void) fclose(qfo);
return (1);
}
- if (quotactl(fsname, QCMD(Q_SYNC, type), 0, (caddr_t)0) < 0 &&
+ if (quotactl(fsname, QCMD(Q_SYNC, type), 0, (caddr_t)0) == -1 &&
errno == EOPNOTSUPP && !warned &&
(flags&(CHECK_DEBUG|CHECK_VERBOSE))) {
warned++;
diff --git a/sbin/restore/dirs.c b/sbin/restore/dirs.c
index 174185615e2..1a25e7342c1 100644
--- a/sbin/restore/dirs.c
+++ b/sbin/restore/dirs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dirs.c,v 1.41 2015/08/25 04:18:43 guenther Exp $ */
+/* $OpenBSD: dirs.c,v 1.42 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: dirs.c,v 1.26 1997/07/01 05:37:49 lukem Exp $ */
/*
@@ -643,7 +643,7 @@ genliteraldir(char *name, ino_t ino)
if (itp == NULL)
panic("Cannot find directory inode %llu named %s\n",
(unsigned long long)ino, name);
- if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) {
+ if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) == -1) {
warn("%s: cannot create file", name);
return (FAIL);
}
diff --git a/sbin/restore/symtab.c b/sbin/restore/symtab.c
index e7322dafb68..39d2b14a79e 100644
--- a/sbin/restore/symtab.c
+++ b/sbin/restore/symtab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: symtab.c,v 1.22 2015/01/16 06:40:00 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.23 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */
/*
@@ -536,11 +536,11 @@ initsymtable(char *filename)
ep->e_flags |= NEW;
return;
}
- if ((fd = open(filename, O_RDONLY, 0)) < 0) {
+ if ((fd = open(filename, O_RDONLY, 0)) == -1) {
warn("open");
panic("cannot open symbol table file %s\n", filename);
}
- if (fstat(fd, &stbuf) < 0) {
+ if (fstat(fd, &stbuf) == -1) {
warn("stat");
panic("cannot stat symbol table file %s\n", filename);
}
@@ -548,8 +548,8 @@ initsymtable(char *filename)
base = calloc(tblsize, sizeof(char));
if (base == NULL)
panic("cannot allocate space for symbol table\n");
- if (read(fd, base, tblsize) < 0 ||
- read(fd, &hdr, sizeof(struct symtableheader)) < 0) {
+ if (read(fd, base, tblsize) == -1 ||
+ read(fd, &hdr, sizeof(struct symtableheader)) == -1) {
warn("read");
panic("cannot read symbol table file %s\n", filename);
}
diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c
index 8c0708adca9..324ec6378d8 100644
--- a/sbin/restore/tape.c
+++ b/sbin/restore/tape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tape.c,v 1.50 2018/04/27 06:46:04 guenther Exp $ */
+/* $OpenBSD: tape.c,v 1.51 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */
/*
@@ -202,7 +202,7 @@ setup(void)
mt = 0;
else
mt = open(magtape, O_RDONLY);
- if (mt < 0)
+ if (mt == -1)
err(1, "%s", magtape);
volno = 1;
setdumpnum();
@@ -234,7 +234,7 @@ setup(void)
printdumpinfo();
dumptime = (time_t)spcl.c_ddate;
dumpdate = (time_t)spcl.c_date;
- if (stat(".", &stbuf) < 0)
+ if (stat(".", &stbuf) == -1)
err(1, "cannot stat .");
if (stbuf.st_blksize > 0 && stbuf.st_blksize < TP_BSIZE )
fssize = TP_BSIZE;
@@ -478,7 +478,7 @@ setdumpnum(void)
rmtioctl(MTFSF, dumpnum - 1);
else
#endif
- if (ioctl(mt, MTIOCTOP, (char *)&tcom) < 0)
+ if (ioctl(mt, MTIOCTOP, (char *)&tcom) == -1)
warn("ioctl MTFSF");
}
@@ -576,7 +576,7 @@ extractfile(char *name)
skipfile();
return (GOOD);
}
- if (mknod(name, mode, (int)curfile.rdev) < 0) {
+ if (mknod(name, mode, (int)curfile.rdev) == -1) {
warn("%s: cannot create special file", name);
skipfile();
return (FAIL);
@@ -596,7 +596,7 @@ extractfile(char *name)
skipfile();
return (GOOD);
}
- if (mkfifo(name, mode) < 0) {
+ if (mkfifo(name, mode) == -1) {
warn("%s: cannot create fifo", name);
skipfile();
return (FAIL);
@@ -617,7 +617,7 @@ extractfile(char *name)
return (GOOD);
}
if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC,
- 0666)) < 0) {
+ 0666)) == -1) {
warn("%s: cannot create file", name);
skipfile();
return (FAIL);
diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c
index 5f499464345..880086ea98c 100644
--- a/sbin/restore/utilities.c
+++ b/sbin/restore/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.19 2015/11/07 21:52:55 guenther Exp $ */
+/* $OpenBSD: utilities.c,v 1.20 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.11 1997/03/19 08:42:56 lukem Exp $ */
/*
@@ -119,7 +119,7 @@ gentempname(struct entry *ep)
void
renameit(char *from, char *to)
{
- if (!Nflag && rename(from, to) < 0) {
+ if (!Nflag && rename(from, to) == -1) {
warn("cannot rename %s to %s", from, to);
return;
}
@@ -137,7 +137,7 @@ newnode(struct entry *np)
if (np->e_type != NODE)
badentry(np, "newnode: not a node");
cp = myname(np);
- if (!Nflag && mkdir(cp, 0777) < 0) {
+ if (!Nflag && mkdir(cp, 0777) == -1) {
np->e_flags |= EXISTED;
warn("%s", cp);
return;
@@ -160,7 +160,7 @@ removenode(struct entry *ep)
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
- if (!Nflag && rmdir(cp) < 0) {
+ if (!Nflag && rmdir(cp) == -1) {
warn("%s", cp);
return;
}
@@ -180,7 +180,7 @@ removeleaf(struct entry *ep)
ep->e_flags |= REMOVED;
ep->e_flags &= ~TMPNAME;
cp = myname(ep);
- if (!Nflag && unlink(cp) < 0) {
+ if (!Nflag && unlink(cp) == -1) {
warn("%s", cp);
return;
}
@@ -195,14 +195,14 @@ linkit(char *existing, char *new, int type)
{
if (type == SYMLINK) {
- if (!Nflag && symlink(existing, new) < 0) {
+ if (!Nflag && symlink(existing, new) == -1) {
warn("cannot create symbolic link %s->%s",
new, existing);
return (FAIL);
}
} else if (type == HARDLINK) {
if (!Nflag && linkat(AT_FDCWD, existing, AT_FDCWD, new, 0)
- < 0) {
+ == -1) {
warn("cannot create hard link %s->%s",
new, existing);
return (FAIL);
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index b5db8daddff..515c6c6052a 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: savecore.c,v 1.61 2019/02/05 02:17:32 deraadt Exp $ */
+/* $OpenBSD: savecore.c,v 1.62 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
@@ -133,7 +133,7 @@ main(int argc, char *argv[])
/* Increase our data size to the max if we can. */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
syslog(LOG_WARNING, "can't set rlimit data size: %m");
}
@@ -538,7 +538,7 @@ err2: syslog(LOG_WARNING,
exit(1);
}
}
- if (nr < 0) {
+ if (nr == -1) {
syslog(LOG_ERR, "%s: %s",
kernel ? kernel : _PATH_UNIX, strerror(errno));
syslog(LOG_WARNING,
@@ -639,12 +639,12 @@ check_space(void)
int fd;
tkernel = kernel ? kernel : _PATH_UNIX;
- if (stat(tkernel, &st) < 0) {
+ if (stat(tkernel, &st) == -1) {
syslog(LOG_ERR, "%s: %m", tkernel);
exit(1);
}
kernelsize = st.st_blocks * S_BLKSIZE;
- if ((fd = open(dirn, O_RDONLY, 0)) < 0 || fstatfs(fd, &fsbuf) < 0) {
+ if ((fd = open(dirn, O_RDONLY, 0)) == -1 || fstatfs(fd, &fsbuf) == -1) {
syslog(LOG_ERR, "%s: %m", dirn);
exit(1);
}
diff --git a/sbin/scan_ffs/scan_ffs.c b/sbin/scan_ffs/scan_ffs.c
index cb80daead4f..d1b673c4dca 100644
--- a/sbin/scan_ffs/scan_ffs.c
+++ b/sbin/scan_ffs/scan_ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scan_ffs.c,v 1.22 2018/04/26 15:55:14 guenther Exp $ */
+/* $OpenBSD: scan_ffs.c,v 1.23 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner
@@ -61,9 +61,9 @@ ufsscan(int fd, daddr_t beg, daddr_t end, int flags)
for (blk = beg; blk <= ((end<0)?blk:end); blk += (SBCOUNT*SBSIZE/512)){
memset(buf, 0, SBSIZE * SBCOUNT);
- if (lseek(fd, (off_t)blk * 512, SEEK_SET) < 0)
+ if (lseek(fd, (off_t)blk * 512, SEEK_SET) == -1)
err(1, "lseek");
- if (read(fd, buf, SBSIZE * SBCOUNT) < 0)
+ if (read(fd, buf, SBSIZE * SBCOUNT) == -1)
err(1, "read");
for (n = 0; n < (SBSIZE * SBCOUNT); n += 512){
@@ -174,7 +174,7 @@ main(int argc, char *argv[])
usage();
fd = opendev(argv[0], O_RDONLY, OPENDEV_PART, NULL);
- if (fd < 0)
+ if (fd == -1)
err(1, "%s", argv[0]);
if (pledge("stdio", NULL) == -1)
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c
index 408fd797a83..4f47ff90271 100644
--- a/sbin/slaacd/frontend.c
+++ b/sbin/slaacd/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.26 2019/03/15 16:45:33 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.27 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -142,7 +142,7 @@ frontend(int debug, int verbose)
setproctitle("%s", log_procnames[slaacd_process]);
log_procinit(log_procnames[slaacd_process]);
- if ((ioctlsock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
+ if ((ioctlsock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == -1)
fatal("socket");
if (setgroups(1, &pw->pw_gid) ||
@@ -466,7 +466,7 @@ get_flags(char *if_name)
struct ifreq ifr;
(void) strlcpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
- if (ioctl(ioctlsock, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)
+ if (ioctl(ioctlsock, SIOCGIFFLAGS, (caddr_t)&ifr) == -1)
fatal("SIOCGIFFLAGS");
return ifr.ifr_flags;
}
@@ -477,7 +477,7 @@ get_xflags(char *if_name)
struct ifreq ifr;
(void) strlcpy(ifr.ifr_name, if_name, sizeof(ifr.ifr_name));
- if (ioctl(ioctlsock, SIOCGIFXFLAGS, (caddr_t)&ifr) < 0)
+ if (ioctl(ioctlsock, SIOCGIFXFLAGS, (caddr_t)&ifr) == -1)
fatal("SIOCGIFXFLAGS");
return ifr.ifr_flags;
}
@@ -560,7 +560,7 @@ update_autoconf_addresses(uint32_t if_index, char* if_name)
(void) strlcpy(ifr6.ifr_name, if_name, sizeof(ifr6.ifr_name));
memcpy(&ifr6.ifr_addr, sin6, sizeof(ifr6.ifr_addr));
- if (ioctl(ioctlsock, SIOCGIFAFLAG_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(ioctlsock, SIOCGIFAFLAG_IN6, (caddr_t)&ifr6) == -1) {
log_warn("SIOCGIFAFLAG_IN6");
continue;
}
@@ -576,7 +576,7 @@ update_autoconf_addresses(uint32_t if_index, char* if_name)
(void) strlcpy(ifr6.ifr_name, if_name, sizeof(ifr6.ifr_name));
memcpy(&ifr6.ifr_addr, sin6, sizeof(ifr6.ifr_addr));
- if (ioctl(ioctlsock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0) {
+ if (ioctl(ioctlsock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) == -1) {
log_warn("SIOCGIFNETMASK_IN6");
continue;
}
@@ -589,8 +589,7 @@ update_autoconf_addresses(uint32_t if_index, char* if_name)
memcpy(&ifr6.ifr_addr, sin6, sizeof(ifr6.ifr_addr));
lifetime = &ifr6.ifr_ifru.ifru_lifetime;
- if (ioctl(ioctlsock, SIOCGIFALIFETIME_IN6, (caddr_t)&ifr6) <
- 0) {
+ if (ioctl(ioctlsock, SIOCGIFALIFETIME_IN6, (caddr_t)&ifr6) == -1) {
log_warn("SIOCGIFALIFETIME_IN6");
continue;
}
@@ -799,7 +798,7 @@ handle_route_message(struct rt_msghdr *rtm, struct sockaddr **rti_info)
memcpy(&ifr6.ifr_addr, sin6, sizeof(ifr6.ifr_addr));
if (ioctl(ioctlsock, SIOCGIFAFLAG_IN6, (caddr_t)&ifr6)
- < 0) {
+ == -1) {
log_warn("SIOCGIFAFLAG_IN6");
break;
}
@@ -990,7 +989,7 @@ icmp6_receive(int fd, short events, void *arg)
int if_index = 0, *hlimp = NULL;
char ntopbuf[INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
- if ((len = recvmsg(fd, &icmp6ev.rcvmhdr, 0)) < 0) {
+ if ((len = recvmsg(fd, &icmp6ev.rcvmhdr, 0)) == -1) {
log_warn("recvmsg");
return;
}
diff --git a/sbin/slaacd/slaacd.c b/sbin/slaacd/slaacd.c
index 4d143b61edc..5d4eda9421f 100644
--- a/sbin/slaacd/slaacd.c
+++ b/sbin/slaacd/slaacd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacd.c,v 1.37 2019/03/31 03:36:18 yasuoka Exp $ */
+/* $OpenBSD: slaacd.c,v 1.38 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -201,7 +201,7 @@ main(int argc, char *argv[])
log_procinit(log_procnames[slaacd_process]);
if ((routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC |
- SOCK_NONBLOCK, AF_INET6)) < 0)
+ SOCK_NONBLOCK, AF_INET6)) == -1)
fatal("route socket");
shutdown(SHUT_RD, routesock);
@@ -239,19 +239,19 @@ main(int argc, char *argv[])
if (main_imsg_send_ipc_sockets(&iev_frontend->ibuf, &iev_engine->ibuf))
fatal("could not establish imsg links");
- if ((ioctl_sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
+ if ((ioctl_sock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == -1)
fatal("socket");
if ((icmp6sock = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC,
- IPPROTO_ICMPV6)) < 0)
+ IPPROTO_ICMPV6)) == -1)
fatal("ICMPv6 socket");
if (setsockopt(icmp6sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
fatal("IPV6_RECVPKTINFO");
if (setsockopt(icmp6sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
fatal("IPV6_RECVHOPLIMIT");
/* only router advertisements */
@@ -262,14 +262,14 @@ main(int argc, char *argv[])
fatal("ICMP6_FILTER");
if ((frontend_routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC,
- AF_INET6)) < 0)
+ AF_INET6)) == -1)
fatal("route socket");
rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_NEWADDR) |
ROUTE_FILTER(RTM_DELADDR) | ROUTE_FILTER(RTM_PROPOSAL) |
ROUTE_FILTER(RTM_DELETE) | ROUTE_FILTER(RTM_CHGADDRATTR);
if (setsockopt(frontend_routesock, AF_ROUTE, ROUTE_MSGFILTER,
- &rtfilter, sizeof(rtfilter)) < 0)
+ &rtfilter, sizeof(rtfilter)) == -1)
fatal("setsockopt(ROUTE_MSGFILTER)");
#ifndef SMALL
@@ -754,7 +754,7 @@ configure_interface(struct imsg_configure_address *address)
log_debug("%s: %s", __func__, if_name);
- if (ioctl(ioctl_sock, SIOCAIFADDR_IN6, &in6_addreq) < 0)
+ if (ioctl(ioctl_sock, SIOCAIFADDR_IN6, &in6_addreq) == -1)
fatal("SIOCAIFADDR_IN6");
if (address->mtu) {
@@ -765,7 +765,7 @@ configure_interface(struct imsg_configure_address *address)
ifr.ifr_mtu = address->mtu;
log_debug("Setting MTU to %d", ifr.ifr_mtu);
- if (ioctl(ioctl_sock, SIOCSIFMTU, &ifr) < 0)
+ if (ioctl(ioctl_sock, SIOCSIFMTU, &ifr) == -1)
log_warn("failed to set MTU");
}
}
diff --git a/sbin/swapctl/swapctl.c b/sbin/swapctl/swapctl.c
index 2511419e961..05ff007bac0 100644
--- a/sbin/swapctl/swapctl.c
+++ b/sbin/swapctl/swapctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swapctl.c,v 1.23 2016/03/17 19:40:43 krw Exp $ */
+/* $OpenBSD: swapctl.c,v 1.24 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: swapctl.c,v 1.9 1998/07/26 20:23:15 mycroft Exp $ */
/*
@@ -300,7 +300,7 @@ void
change_priority(char *path)
{
- if (swapctl(SWAP_CTL, path, pri) < 0)
+ if (swapctl(SWAP_CTL, path, pri) == -1)
warn("%s", path);
}
@@ -311,7 +311,7 @@ void
add_swap(char *path)
{
- if (swapctl(SWAP_ON, path, pri) < 0)
+ if (swapctl(SWAP_ON, path, pri) == -1)
if (errno != EBUSY)
err(1, "%s", path);
}
@@ -323,7 +323,7 @@ void
del_swap(char *path)
{
- if (swapctl(SWAP_OFF, path, pri) < 0)
+ if (swapctl(SWAP_OFF, path, pri) == -1)
err(1, "%s", path);
}
@@ -402,7 +402,7 @@ do_fstab(void)
(char *)NULL);
err(1, "execl");
}
- while (waitpid(pid, &status, 0) < 0)
+ while (waitpid(pid, &status, 0) == -1)
if (errno != EINTR)
err(1, "waitpid");
if (status != 0) {
@@ -422,7 +422,7 @@ do_fstab(void)
if (strncmp("/dev/", spec, 5) != 0)
continue;
}
- if (stat(spec, &st) < 0) {
+ if (stat(spec, &st) == -1) {
warn("%s", spec);
continue;
}
@@ -437,7 +437,7 @@ do_fstab(void)
continue;
}
- if (swapctl(SWAP_ON, spec, (int)priority) < 0) {
+ if (swapctl(SWAP_ON, spec, (int)priority) == -1) {
if (errno != EBUSY)
warn("%s", spec);
} else {
diff --git a/sbin/swapctl/swaplist.c b/sbin/swapctl/swaplist.c
index 1f915bd0f2b..66f093209f5 100644
--- a/sbin/swapctl/swaplist.c
+++ b/sbin/swapctl/swaplist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swaplist.c,v 1.12 2015/12/10 17:27:00 mmcc Exp $ */
+/* $OpenBSD: swaplist.c,v 1.13 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: swaplist.c,v 1.8 1998/10/08 10:00:31 mrg Exp $ */
/*
@@ -62,7 +62,7 @@ list_swap(int pri, int kflag, int pflag, int dolong)
if (sep == NULL)
err(1, "calloc");
rnswap = swapctl(SWAP_STATS, (void *)sep, nswap);
- if (rnswap < 0)
+ if (rnswap == -1)
err(1, "SWAP_STATS");
if (nswap != rnswap)
warnx("SWAP_STATS different to SWAP_NSWAP (%d != %d)",
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 0bb29fc2266..4db2f2b661d 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.243 2019/06/16 09:30:15 mestre Exp $ */
+/* $OpenBSD: sysctl.c,v 1.244 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -1228,7 +1228,7 @@ vfsinit(void)
mib[1] = VFS_GENERIC;
mib[2] = VFS_MAXTYPENUM;
buflen = 4;
- if (sysctl(mib, 3, &maxtypenum, &buflen, NULL, 0) < 0)
+ if (sysctl(mib, 3, &maxtypenum, &buflen, NULL, 0) == -1)
return;
/*
* We need to do 0..maxtypenum so add one, and then we offset them
@@ -1250,7 +1250,7 @@ vfsinit(void)
buflen = sizeof vfc;
for (loc = lastused, cnt = 1; cnt < maxtypenum; cnt++) {
mib[3] = cnt - 1;
- if (sysctl(mib, 4, &vfc, &buflen, NULL, 0) < 0) {
+ if (sysctl(mib, 4, &vfc, &buflen, NULL, 0) == -1) {
if (errno == EOPNOTSUPP)
continue;
warn("vfsinit");
@@ -1309,7 +1309,7 @@ sysctl_vfsgen(char *string, char **bufpp, int mib[], int flags, int *typep)
mib[2] = VFS_CONF;
mib[3] = indx;
size = sizeof vfc;
- if (sysctl(mib, 4, &vfc, &size, NULL, 0) < 0) {
+ if (sysctl(mib, 4, &vfc, &size, NULL, 0) == -1) {
if (errno != EOPNOTSUPP)
warn("vfs print");
return -1;
@@ -1767,7 +1767,7 @@ sysctl_nchstats(char *string, char **bufpp, int mib[], int flags, int *typep)
}
if (keepvalue == 0) {
size = sizeof(struct nchstats);
- if (sysctl(mib, 2, &nch, &size, NULL, 0) < 0)
+ if (sysctl(mib, 2, &nch, &size, NULL, 0) == -1)
return (-1);
keepvalue = 1;
}
@@ -1863,7 +1863,7 @@ sysctl_forkstat(char *string, char **bufpp, int mib[], int flags, int *typep)
}
if (keepvalue == 0) {
size = sizeof(struct forkstat);
- if (sysctl(mib, 2, &fks, &size, NULL, 0) < 0)
+ if (sysctl(mib, 2, &fks, &size, NULL, 0) == -1)
return (-1);
keepvalue = 1;
}
@@ -1923,7 +1923,7 @@ sysctl_malloc(char *string, char **bufpp, int mib[], int flags, int *typep)
stor = mib[2];
mib[2] = KERN_MALLOC_BUCKETS;
buf = bufp;
- if (sysctl(mib, 3, buf, &size, NULL, 0) < 0)
+ if (sysctl(mib, 3, buf, &size, NULL, 0) == -1)
return (-1);
mib[2] = stor;
for (stor = 0, i = 0; i < size; i++)
@@ -1953,7 +1953,7 @@ sysctl_malloc(char *string, char **bufpp, int mib[], int flags, int *typep)
stor = mib[2];
mib[2] = KERN_MALLOC_KMEMNAMES;
buf = bufp;
- if (sysctl(mib, 3, buf, &size, NULL, 0) < 0)
+ if (sysctl(mib, 3, buf, &size, NULL, 0) == -1)
return (-1);
mib[2] = stor;
if ((name = strsep(bufpp, ".")) == NULL) {
@@ -2034,23 +2034,23 @@ sysctl_chipset(char *string, char **bufpp, int mib[], int flags, int *typep)
case CPU_CHIPSET_PORTS:
case CPU_CHIPSET_HAE_MASK:
len = sizeof(void *);
- if (sysctl(mib, 3, &q, &len, NULL, 0) < 0)
+ if (sysctl(mib, 3, &q, &len, NULL, 0) == -1)
goto done;
printf("%p", q);
break;
case CPU_CHIPSET_BWX:
len = sizeof(int);
- if (sysctl(mib, 3, &bwx, &len, NULL, 0) < 0)
+ if (sysctl(mib, 3, &bwx, &len, NULL, 0) == -1)
goto done;
printf("%d", bwx);
break;
case CPU_CHIPSET_TYPE:
- if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0)
+ if (sysctl(mib, 3, NULL, &len, NULL, 0) == -1)
goto done;
p = malloc(len + 1);
if (p == NULL)
goto done;
- if (sysctl(mib, 3, p, &len, NULL, 0) < 0) {
+ if (sysctl(mib, 3, p, &len, NULL, 0) == -1) {
free(p);
goto done;
}
diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c
index 9f6d1323f97..c2eced0e384 100644
--- a/sbin/umount/umount.c
+++ b/sbin/umount/umount.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umount.c,v 1.28 2018/01/05 08:13:31 mpi Exp $ */
+/* $OpenBSD: umount.c,v 1.29 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: umount.c,v 1.16 1996/05/11 14:13:55 mycroft Exp $ */
/*-
@@ -214,7 +214,7 @@ umountfs(char *oname)
if (verbose)
printf("%s: unmount from %s\n", name, mntpt);
- if (unmount(mntpt, fflag) < 0) {
+ if (unmount(mntpt, fflag) == -1) {
warn("%s", mntpt);
return (1);
}
diff --git a/sbin/unwind/frontend.c b/sbin/unwind/frontend.c
index fffb6fa3859..c108ade519a 100644
--- a/sbin/unwind/frontend.c
+++ b/sbin/unwind/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.21 2019/05/14 14:51:31 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.22 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -648,7 +648,7 @@ udp_receive(int fd, short events, void *arg)
uint8_t *queryp;
char *str_from, *str, buf[1024], *bufp;
- if ((len = recvmsg(fd, &udpev->rcvmhdr, 0)) < 0) {
+ if ((len = recvmsg(fd, &udpev->rcvmhdr, 0)) == -1) {
log_warn("recvmsg");
return;
}
diff --git a/sbin/unwind/unwind.c b/sbin/unwind/unwind.c
index 6d381d99961..4cd19f11e77 100644
--- a/sbin/unwind/unwind.c
+++ b/sbin/unwind/unwind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwind.c,v 1.28 2019/05/14 14:51:31 florian Exp $ */
+/* $OpenBSD: unwind.c,v 1.29 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -289,13 +289,13 @@ main(int argc, char *argv[])
fatalx("control socket setup failed");
if ((frontend_routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC,
- AF_INET)) < 0)
+ AF_INET)) == -1)
fatal("route socket");
rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_PROPOSAL) |
ROUTE_FILTER(RTM_GET);
if (setsockopt(frontend_routesock, AF_ROUTE, ROUTE_MSGFILTER,
- &rtfilter, sizeof(rtfilter)) < 0)
+ &rtfilter, sizeof(rtfilter)) == -1)
fatal("setsockopt(ROUTE_MSGFILTER)");
if ((ta_fd = open(TRUST_ANCHOR_FILE, O_RDWR | O_CREAT, 0644)) == -1)
diff --git a/sbin/vnconfig/vnconfig.c b/sbin/vnconfig/vnconfig.c
index 6a89df98f6d..cc179e08a74 100644
--- a/sbin/vnconfig/vnconfig.c
+++ b/sbin/vnconfig/vnconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnconfig.c,v 1.4 2019/04/28 16:28:00 jmc Exp $ */
+/* $OpenBSD: vnconfig.c,v 1.5 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 1993 University of Utah.
* Copyright (c) 1990, 1993
@@ -238,7 +238,7 @@ getinfo(const char *vname, int *availp)
}
vd = opendev((char *)vname, O_RDONLY, OPENDEV_PART, NULL);
- if (vd < 0)
+ if (vd == -1)
err(1, "open: %s", vname);
vnu.vnu_unit = -1;
@@ -296,7 +296,7 @@ config(char *file, char *dev, struct disklabel *dp, char *key, size_t keylen)
asprintf(&dev, "vnd%d", unit);
}
- if ((fd = opendev(dev, O_RDONLY, OPENDEV_PART, &rdev)) < 0) {
+ if ((fd = opendev(dev, O_RDONLY, OPENDEV_PART, &rdev)) == -1) {
err(4, "%s", rdev);
goto out;
}
@@ -324,7 +324,7 @@ config(char *file, char *dev, struct disklabel *dp, char *key, size_t keylen)
out:
if (key)
explicit_bzero(key, keylen);
- return (rv < 0);
+ return (rv == -1);
}
int
@@ -334,7 +334,7 @@ unconfig(char *vnd)
int fd, rv = -1, unit;
char *rdev;
- if ((fd = opendev(vnd, O_RDONLY, OPENDEV_PART, &rdev)) < 0)
+ if ((fd = opendev(vnd, O_RDONLY, OPENDEV_PART, &rdev)) == -1)
err(4, "%s", rdev);
memset(&vndio, 0, sizeof vndio);
@@ -351,7 +351,7 @@ unconfig(char *vnd)
close(fd);
fflush(stdout);
- return (rv < 0);
+ return (rv == -1);
}
__dead void
diff --git a/sbin/wsconsctl/display.c b/sbin/wsconsctl/display.c
index fba7f6cdaeb..47245bbd4a3 100644
--- a/sbin/wsconsctl/display.c
+++ b/sbin/wsconsctl/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.21 2019/03/27 17:24:17 fcambus Exp $ */
+/* $OpenBSD: display.c,v 1.22 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: display.c,v 1.1 1998/12/28 14:01:16 hannken Exp $ */
/*-
@@ -144,7 +144,7 @@ display_get_values(int fd)
(cmd == WSDISPLAYIO_GBURNER && !bon) ||
(cmd == WSDISPLAYIO_GINFO && !fbon)) {
errno = ENOTTY;
- if (!cmd || ioctl(fd, cmd, ptr) < 0) {
+ if (!cmd || ioctl(fd, cmd, ptr) == -1) {
if (errno == ENOTTY) {
pf->flags |= FLG_DEAD;
continue;
@@ -265,7 +265,7 @@ display_put_values(int fd)
}
errno = ENOTTY;
- if (!cmd || ioctl(fd, cmd, ptr) < 0) {
+ if (!cmd || ioctl(fd, cmd, ptr) == -1) {
if (errno == ENOTTY) {
pf->flags |= FLG_DEAD;
continue;
diff --git a/sbin/wsconsctl/keyboard.c b/sbin/wsconsctl/keyboard.c
index d60261b5a06..50773c69c59 100644
--- a/sbin/wsconsctl/keyboard.c
+++ b/sbin/wsconsctl/keyboard.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyboard.c,v 1.13 2015/12/12 12:31:37 jung Exp $ */
+/* $OpenBSD: keyboard.c,v 1.14 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: keyboard.c 1.1 1998/12/28 14:01:17 hannken Exp $ */
/*-
@@ -78,7 +78,7 @@ keyboard_get_values(int fd)
struct field *pf;
if (field_by_value(keyboard_field_tab, &kbtype)->flags & FLG_GET)
- if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0)
+ if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) == -1)
warn("WSKBDIO_GTYPE");
bell.which = 0;
@@ -88,7 +88,7 @@ keyboard_get_values(int fd)
bell.which |= WSKBD_BELL_DOPERIOD;
if (field_by_value(keyboard_field_tab, &bell.volume)->flags & FLG_GET)
bell.which |= WSKBD_BELL_DOVOLUME;
- if (bell.which != 0 && ioctl(fd, WSKBDIO_GETBELL, &bell) < 0)
+ if (bell.which != 0 && ioctl(fd, WSKBDIO_GETBELL, &bell) == -1)
warn("WSKBDIO_GETBELL");
dfbell.which = 0;
@@ -99,14 +99,14 @@ keyboard_get_values(int fd)
if (field_by_value(keyboard_field_tab, &dfbell.volume)->flags & FLG_GET)
dfbell.which |= WSKBD_BELL_DOVOLUME;
if (dfbell.which != 0 &&
- ioctl(fd, WSKBDIO_GETDEFAULTBELL, &dfbell) < 0)
+ ioctl(fd, WSKBDIO_GETDEFAULTBELL, &dfbell) == -1)
warn("WSKBDIO_GETDEFAULTBELL");
if (field_by_value(keyboard_field_tab, &kbmap)->flags & FLG_GET) {
kbmap.maplen = KS_NUMKEYCODES;
- if (ioctl(fd, WSKBDIO_GETMAP, &kbmap) < 0)
+ if (ioctl(fd, WSKBDIO_GETMAP, &kbmap) == -1)
warn("WSKBDIO_GETMAP");
- if (ioctl(fd, WSKBDIO_GETENCODING, &kbdencoding) < 0)
+ if (ioctl(fd, WSKBDIO_GETENCODING, &kbdencoding) == -1)
warn("WSKBDIO_GETENCODING");
ksymenc(kbdencoding);
}
@@ -117,7 +117,7 @@ keyboard_get_values(int fd)
if (field_by_value(keyboard_field_tab, &repeat.delN)->flags & FLG_GET)
repeat.which |= WSKBD_KEYREPEAT_DODELN;
if (repeat.which != 0 &&
- ioctl(fd, WSKBDIO_GETKEYREPEAT, &repeat) < 0)
+ ioctl(fd, WSKBDIO_GETKEYREPEAT, &repeat) == -1)
warn("WSKBDIO_GETKEYREPEAT");
dfrepeat.which = 0;
@@ -126,21 +126,21 @@ keyboard_get_values(int fd)
if (field_by_value(keyboard_field_tab, &dfrepeat.delN)->flags & FLG_GET)
dfrepeat.which |= WSKBD_KEYREPEAT_DODELN;
if (dfrepeat.which != 0 &&
- ioctl(fd, WSKBDIO_GETDEFAULTKEYREPEAT, &dfrepeat) < 0)
+ ioctl(fd, WSKBDIO_GETDEFAULTKEYREPEAT, &dfrepeat) == -1)
warn("WSKBDIO_GETDEFAULTKEYREPEAT");
if (field_by_value(keyboard_field_tab, &ledstate)->flags & FLG_GET)
- if (ioctl(fd, WSKBDIO_GETLEDS, &ledstate) < 0)
+ if (ioctl(fd, WSKBDIO_GETLEDS, &ledstate) == -1)
warn("WSKBDIO_GETLEDS");
if (field_by_value(keyboard_field_tab, &kbdencoding)->flags & FLG_GET)
- if (ioctl(fd, WSKBDIO_GETENCODING, &kbdencoding) < 0)
+ if (ioctl(fd, WSKBDIO_GETENCODING, &kbdencoding) == -1)
warn("WSKBDIO_GETENCODING");
pf = field_by_value(keyboard_field_tab, &backlight);
if (pf->flags & FLG_GET && !(pf->flags & FLG_DEAD)) {
errno = ENOTTY;
- if (ioctl(fd, WSKBDIO_GETBACKLIGHT, &kbl) < 0) {
+ if (ioctl(fd, WSKBDIO_GETBACKLIGHT, &kbl) == -1) {
if (errno == ENOTTY)
pf->flags |= FLG_DEAD;
else
@@ -166,7 +166,7 @@ keyboard_put_values(int fd)
bell.which |= WSKBD_BELL_DOPERIOD;
if (field_by_value(keyboard_field_tab, &bell.volume)->flags & FLG_SET)
bell.which |= WSKBD_BELL_DOVOLUME;
- if (bell.which != 0 && ioctl(fd, WSKBDIO_SETBELL, &bell) < 0) {
+ if (bell.which != 0 && ioctl(fd, WSKBDIO_SETBELL, &bell) == -1) {
warn("WSKBDIO_SETBELL");
return 1;
}
@@ -179,13 +179,13 @@ keyboard_put_values(int fd)
if (field_by_value(keyboard_field_tab, &dfbell.volume)->flags & FLG_SET)
dfbell.which |= WSKBD_BELL_DOVOLUME;
if (dfbell.which != 0 &&
- ioctl(fd, WSKBDIO_SETDEFAULTBELL, &dfbell) < 0) {
+ ioctl(fd, WSKBDIO_SETDEFAULTBELL, &dfbell) == -1) {
warn("WSKBDIO_SETDEFAULTBELL");
return 1;
}
if (field_by_value(keyboard_field_tab, &kbmap)->flags & FLG_SET) {
- if (ioctl(fd, WSKBDIO_SETMAP, &kbmap) < 0) {
+ if (ioctl(fd, WSKBDIO_SETMAP, &kbmap) == -1) {
warn("WSKBDIO_SETMAP");
return 1;
}
@@ -197,7 +197,7 @@ keyboard_put_values(int fd)
if (field_by_value(keyboard_field_tab, &repeat.delN)->flags & FLG_SET)
repeat.which |= WSKBD_KEYREPEAT_DODELN;
if (repeat.which != 0 &&
- ioctl(fd, WSKBDIO_SETKEYREPEAT, &repeat) < 0) {
+ ioctl(fd, WSKBDIO_SETKEYREPEAT, &repeat) == -1) {
warn("WSKBDIO_SETKEYREPEAT");
return 1;
}
@@ -208,20 +208,20 @@ keyboard_put_values(int fd)
if (field_by_value(keyboard_field_tab, &dfrepeat.delN)->flags & FLG_SET)
dfrepeat.which |= WSKBD_KEYREPEAT_DODELN;
if (dfrepeat.which != 0 &&
- ioctl(fd, WSKBDIO_SETDEFAULTKEYREPEAT, &dfrepeat) < 0) {
+ ioctl(fd, WSKBDIO_SETDEFAULTKEYREPEAT, &dfrepeat) == -1) {
warn("WSKBDIO_SETDEFAULTKEYREPEAT");
return 1;
}
if (field_by_value(keyboard_field_tab, &ledstate)->flags & FLG_SET) {
- if (ioctl(fd, WSKBDIO_SETLEDS, &ledstate) < 0) {
+ if (ioctl(fd, WSKBDIO_SETLEDS, &ledstate) == -1) {
warn("WSKBDIO_SETLEDS");
return 1;
}
}
if (field_by_value(keyboard_field_tab, &kbdencoding)->flags & FLG_SET) {
- if (ioctl(fd, WSKBDIO_SETENCODING, &kbdencoding) < 0) {
+ if (ioctl(fd, WSKBDIO_SETENCODING, &kbdencoding) == -1) {
warn("WSKBDIO_SETENCODING");
return 1;
}
@@ -233,7 +233,7 @@ keyboard_put_values(int fd)
kbl.curval = backlight.cur;
kbl.max = backlight.max;
errno = ENOTTY;
- if (ioctl(fd, WSKBDIO_SETBACKLIGHT, &kbl) < 0) {
+ if (ioctl(fd, WSKBDIO_SETBACKLIGHT, &kbl) == -1) {
if (errno == ENOTTY)
pf->flags |= FLG_DEAD;
else {
diff --git a/sbin/wsconsctl/mouse.c b/sbin/wsconsctl/mouse.c
index a0ee9080f48..5fc70436eaa 100644
--- a/sbin/wsconsctl/mouse.c
+++ b/sbin/wsconsctl/mouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mouse.c,v 1.18 2018/05/07 22:15:36 bru Exp $ */
+/* $OpenBSD: mouse.c,v 1.19 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: mouse.c,v 1.3 1999/11/15 13:47:30 ad Exp $ */
/*-
@@ -108,11 +108,11 @@ mouse_get_values(int fd)
struct field *f;
if (field_by_value(mouse_field_tab, &mstype)->flags & FLG_GET)
- if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) < 0)
+ if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) == -1)
warn("WSMOUSEIO_GTYPE");
if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_GET) {
- if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) < 0) {
+ if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) == -1) {
if (errno == ENOTTY)
field_by_value(mouse_field_tab,
&rawmode)->flags |= FLG_DEAD;
@@ -123,7 +123,7 @@ mouse_get_values(int fd)
}
if (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_GET)
- if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) < 0) {
+ if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords) == -1) {
if (errno == ENOTTY)
field_by_value(mouse_field_tab,
&wmcoords)->flags |= FLG_DEAD;
@@ -148,14 +148,14 @@ mouse_put_values(int fd)
struct field *f;
if (field_by_value(mouse_field_tab, &resolution)->flags & FLG_SET) {
- if (ioctl(fd, WSMOUSEIO_SRES, &resolution) < 0) {
+ if (ioctl(fd, WSMOUSEIO_SRES, &resolution) == -1) {
warn("WSMOUSEIO_SRES");
return 1;
}
}
if (field_by_value(mouse_field_tab, &rawmode)->flags & FLG_SET) {
wmcoords.samplelen = rawmode;
- if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) < 0) {
+ if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) == -1) {
if (errno == ENOTTY) {
field_by_value(mouse_field_tab,
&rawmode)->flags |= FLG_DEAD;
@@ -166,7 +166,7 @@ mouse_put_values(int fd)
}
}
if (field_by_value(mouse_field_tab, &wmcoords)->flags & FLG_SET) {
- if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords_save) < 0) {
+ if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &wmcoords_save) == -1) {
if (errno == ENOTTY)
field_by_value(mouse_field_tab,
&wmcoords)->flags |= FLG_DEAD;
@@ -174,7 +174,7 @@ mouse_put_values(int fd)
warn("WSMOUSEIO_GCALIBCOORDS");
}
wmcoords.samplelen = wmcoords_save.samplelen;
- if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) < 0) {
+ if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &wmcoords) == -1) {
if (errno == ENOTTY) {
field_by_value(mouse_field_tab,
&wmcoords)->flags |= FLG_DEAD;
diff --git a/sbin/wsconsctl/wsconsctl.c b/sbin/wsconsctl/wsconsctl.c
index 1c62df8fe5d..efb3f17613b 100644
--- a/sbin/wsconsctl/wsconsctl.c
+++ b/sbin/wsconsctl/wsconsctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsconsctl.c,v 1.31 2017/07/21 20:38:20 bru Exp $ */
+/* $OpenBSD: wsconsctl.c,v 1.32 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: wsconsctl.c,v 1.2 1998/12/29 22:40:20 hannken Exp $ */
/*-
@@ -120,8 +120,8 @@ main(int argc, char *argv[])
for (devidx = 0;; devidx++) {
device = (*sw->nextdev)(devidx);
if (!device ||
- ((devfd = open(device, O_WRONLY)) < 0 &&
- (devfd = open(device, O_RDONLY)) < 0)) {
+ ((devfd = open(device, O_WRONLY)) == -1 &&
+ (devfd = open(device, O_RDONLY)) == -1)) {
if (!device || errno != ENXIO) {
if (device && errno != ENOENT) {
warn("%s", device);
@@ -170,8 +170,8 @@ main(int argc, char *argv[])
device = wdev;
if (!device ||
- ((devfd = open(device, O_WRONLY)) < 0 &&
- (devfd = open(device, O_RDONLY)) < 0)) {
+ ((devfd = open(device, O_WRONLY)) == -1 &&
+ (devfd = open(device, O_RDONLY)) == -1)) {
if (!device) {
const char *c = strchr(argv[i], '.');
int k;
diff --git a/usr.sbin/acme-client/http.c b/usr.sbin/acme-client/http.c
index 1811d1bd684..329773907ad 100644
--- a/usr.sbin/acme-client/http.c
+++ b/usr.sbin/acme-client/http.c
@@ -1,4 +1,4 @@
-/* $Id: http.c,v 1.26 2019/06/07 08:07:52 florian Exp $ */
+/* $Id: http.c,v 1.27 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -72,7 +72,7 @@ dosysread(char *buf, size_t sz, const struct http *http)
ssize_t rc;
rc = read(http->fd, buf, sz);
- if (rc < 0)
+ if (rc == -1)
warn("%s: read", http->src.ip);
return rc;
}
@@ -83,7 +83,7 @@ dosyswrite(const void *buf, size_t sz, const struct http *http)
ssize_t rc;
rc = write(http->fd, buf, sz);
- if (rc < 0)
+ if (rc == -1)
warn("%s: write", http->src.ip);
return rc;
}
@@ -97,7 +97,7 @@ dotlsread(char *buf, size_t sz, const struct http *http)
rc = tls_read(http->ctx, buf, sz);
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
- if (rc < 0)
+ if (rc == -1)
warnx("%s: tls_read: %s", http->src.ip,
tls_error(http->ctx));
return rc;
@@ -112,7 +112,7 @@ dotlswrite(const void *buf, size_t sz, const struct http *http)
rc = tls_write(http->ctx, buf, sz);
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
- if (rc < 0)
+ if (rc == -1)
warnx("%s: tls_write: %s", http->src.ip,
tls_error(http->ctx));
return rc;
diff --git a/usr.sbin/acme-client/util.c b/usr.sbin/acme-client/util.c
index 3fb7fa7c4e2..4da5b294163 100644
--- a/usr.sbin/acme-client/util.c
+++ b/usr.sbin/acme-client/util.c
@@ -1,4 +1,4 @@
-/* $Id: util.c,v 1.11 2018/03/15 18:26:47 otto Exp $ */
+/* $Id: util.c,v 1.12 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -91,7 +91,7 @@ readop(int fd, enum comm comm)
long op;
ssz = read(fd, &op, sizeof(long));
- if (ssz < 0) {
+ if (ssz == -1) {
warn("read: %s", comms[comm]);
return LONG_MAX;
} else if (ssz && ssz != sizeof(long)) {
@@ -124,7 +124,7 @@ readbuf(int fd, enum comm comm, size_t *sz)
size_t rsz, lsz;
char *p = NULL;
- if ((ssz = read(fd, sz, sizeof(size_t))) < 0) {
+ if ((ssz = read(fd, sz, sizeof(size_t))) == -1) {
warn("read: %s length", comms[comm]);
return NULL;
} else if ((size_t)ssz != sizeof(size_t)) {
@@ -143,7 +143,7 @@ readbuf(int fd, enum comm comm, size_t *sz)
rsz = 0;
lsz = *sz;
while (lsz) {
- if ((ssz = read(fd, p + rsz, lsz)) < 0) {
+ if ((ssz = read(fd, p + rsz, lsz)) == -1) {
warn("read: %s", comms[comm]);
break;
} else if (ssz > 0) {
@@ -175,7 +175,7 @@ writeop(int fd, enum comm comm, long op)
sigfp = signal(SIGPIPE, sigpipe);
- if ((ssz = write(fd, &op, sizeof(long))) < 0) {
+ if ((ssz = write(fd, &op, sizeof(long))) == -1) {
if ((er = errno) != EPIPE)
warn("write: %s", comms[comm]);
signal(SIGPIPE, sigfp);
@@ -212,7 +212,7 @@ writebuf(int fd, enum comm comm, const void *v, size_t sz)
sigfp = signal(SIGPIPE, sigpipe);
- if ((ssz = write(fd, &sz, sizeof(size_t))) < 0) {
+ if ((ssz = write(fd, &sz, sizeof(size_t))) == -1) {
if ((er = errno) != EPIPE)
warn("write: %s length", comms[comm]);
signal(SIGPIPE, sigfp);
@@ -223,7 +223,7 @@ writebuf(int fd, enum comm comm, const void *v, size_t sz)
if ((size_t)ssz != sizeof(size_t))
warnx("short write: %s length", comms[comm]);
- else if ((ssz = write(fd, v, sz)) < 0) {
+ else if ((ssz = write(fd, v, sz)) == -1) {
if (errno == EPIPE)
rc = 0;
else
diff --git a/usr.sbin/amd/amd/amd.c b/usr.sbin/amd/amd/amd.c
index 3f46c4e82df..b41ee0be9ee 100644
--- a/usr.sbin/amd/amd/amd.c
+++ b/usr.sbin/amd/amd/amd.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amd.c 8.1 (Berkeley) 6/6/93
- * $Id: amd.c,v 1.22 2015/09/11 19:03:30 millert Exp $
+ * $Id: amd.c,v 1.23 2019/06/28 13:32:46 deraadt Exp $
*/
/*
@@ -167,11 +167,11 @@ daemon_mode(void)
#ifdef TIOCNOTTY
{
int t = open("/dev/tty", O_RDWR);
- if (t < 0) {
+ if (t == -1) {
if (errno != ENXIO) /* not an error if already no controlling tty */
plog(XLOG_WARNING, "Could not open controlling tty: %m");
} else {
- if (ioctl(t, TIOCNOTTY, 0) < 0 && errno != ENOTTY)
+ if (ioctl(t, TIOCNOTTY, 0) == -1 && errno != ENOTTY)
plog(XLOG_WARNING, "Could not disassociate tty (TIOCNOTTY): %m");
(void) close(t);
}
@@ -211,7 +211,7 @@ main(int argc, char *argv[])
/*
* Get local machine name
*/
- if (gethostname(hostname, sizeof(hostname)) < 0) {
+ if (gethostname(hostname, sizeof(hostname)) == -1) {
plog(XLOG_FATAL, "gethostname: %m");
going_down(1);
}
diff --git a/usr.sbin/amd/amd/rpc_fwd.c b/usr.sbin/amd/amd/rpc_fwd.c
index 442912b1d36..917cf7bc421 100644
--- a/usr.sbin/amd/amd/rpc_fwd.c
+++ b/usr.sbin/amd/amd/rpc_fwd.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)rpc_fwd.c 8.1 (Berkeley) 6/6/93
- * $Id: rpc_fwd.c,v 1.10 2015/09/13 15:44:47 guenther Exp $
+ * $Id: rpc_fwd.c,v 1.11 2019/06/28 13:32:46 deraadt Exp $
*/
/*
@@ -162,7 +162,7 @@ int fwd_init()
* Create ping socket
*/
fwd_sock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
- if (fwd_sock < 0) {
+ if (fwd_sock == -1) {
plog(XLOG_ERROR, "Unable to create RPC forwarding socket: %m");
return errno;
}
@@ -170,7 +170,7 @@ int fwd_init()
/*
* Some things we talk to require a priv port - so make one here
*/
- if (bind_resv_port(fwd_sock, (unsigned short *) 0) < 0)
+ if (bind_resv_port(fwd_sock, (unsigned short *) 0) == -1)
plog(XLOG_ERROR, "can't bind privileged port");
return 0;
@@ -278,7 +278,7 @@ fwd_packet(int type_id, void *pkt, int len, struct sockaddr_in *fwdto,
}
#endif /* DEBUG */
if (sendto(fwd_sock, (char *) pkt, len, 0,
- (struct sockaddr *) fwdto, sizeof(*fwdto)) < 0)
+ (struct sockaddr *) fwdto, sizeof(*fwdto)) == -1)
error = errno;
/*
@@ -316,7 +316,7 @@ fwd_reply()
* Determine the length of the packet
*/
#ifdef DYNAMIC_BUFFERS
- if (ioctl(fwd_sock, FIONREAD, &len) < 0 || len < 0) {
+ if (ioctl(fwd_sock, FIONREAD, &len) == -1 || len < 0) {
plog(XLOG_ERROR, "Error reading packet size: %m");
return;
}
@@ -340,9 +340,9 @@ again:
src_addr_len = sizeof(src_addr);
rc = recvfrom(fwd_sock, (char *) pkt, len, 0,
(struct sockaddr *) &src_addr, &src_addr_len);
- if (rc < 0 || src_addr_len != sizeof(src_addr) ||
+ if (rc == -1 || src_addr_len != sizeof(src_addr) ||
src_addr.sin_family != AF_INET) {
- if (rc < 0 && errno == EINTR)
+ if (rc == -1 && errno == EINTR)
goto again;
plog(XLOG_ERROR, "Error reading RPC reply: %m");
goto out;
diff --git a/usr.sbin/apm/apm.c b/usr.sbin/apm/apm.c
index a4d45ef4413..69aba9a3c8a 100644
--- a/usr.sbin/apm/apm.c
+++ b/usr.sbin/apm/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.35 2019/03/01 17:21:48 tedu Exp $ */
+/* $OpenBSD: apm.c,v 1.36 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
int cpuspeed_mib[] = { CTL_HW, HW_CPUSPEED }, cpuspeed;
size_t cpuspeed_sz = sizeof(cpuspeed);
- if (sysctl(cpuspeed_mib, 2, &cpuspeed, &cpuspeed_sz, NULL, 0) < 0)
+ if (sysctl(cpuspeed_mib, 2, &cpuspeed, &cpuspeed_sz, NULL, 0) == -1)
err(1, "sysctl hw.cpuspeed");
while ((ch = getopt(argc, argv, "ACHLlmbvaPSzZf:")) != -1) {
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index 8254b791a21..ab1f2900908 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.84 2018/12/04 18:00:57 tedu Exp $ */
+/* $OpenBSD: apmd.c,v 1.85 2019/06/28 13:32:46 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -316,7 +316,7 @@ handle_client(int sock_fd, int ctl_fd)
break;
}
- if (sysctl(cpuspeed_mib, 2, &cpuspeed, &cpuspeed_sz, NULL, 0) < 0)
+ if (sysctl(cpuspeed_mib, 2, &cpuspeed, &cpuspeed_sz, NULL, 0) == -1)
logmsg(LOG_INFO, "cannot read hw.cpuspeed");
reply.cpuspeed = cpuspeed;
@@ -464,7 +464,7 @@ main(int argc, char *argv[])
doperf = PERF_MANUAL;
if (debug == 0) {
- if (daemon(0, 0) < 0)
+ if (daemon(0, 0) == -1)
error("failed to daemonize", NULL);
openlog(__progname, LOG_CONS, LOG_DAEMON);
setlogmask(LOG_UPTO(LOG_NOTICE));
@@ -501,10 +501,10 @@ main(int argc, char *argv[])
EV_CLEAR, 0, 0, NULL);
nchanges = 2;
}
- if (kevent(kq, ev, nchanges, NULL, 0, &sts) < 0)
+ if (kevent(kq, ev, nchanges, NULL, 0, &sts) == -1)
error("kevent", NULL);
- if (sysctl(ncpu_mib, 2, &ncpu, &ncpu_sz, NULL, 0) < 0)
+ if (sysctl(ncpu_mib, 2, &ncpu, &ncpu_sz, NULL, 0) == -1)
error("cannot read hw.ncpu", NULL);
for (;;) {
@@ -513,7 +513,7 @@ main(int argc, char *argv[])
sts = ts;
apmtimeout += 1;
- if ((rv = kevent(kq, NULL, 0, ev, 1, &sts)) < 0)
+ if ((rv = kevent(kq, NULL, 0, ev, 1, &sts)) == -1)
break;
if (apmtimeout >= ts.tv_sec) {
@@ -645,7 +645,8 @@ setperfpolicy(char *policy)
setlo = 1;
}
- if (sysctl(hw_perfpol_mib, 2, oldpolicy, &oldsz, policy, strlen(policy) + 1) < 0)
+ if (sysctl(hw_perfpol_mib, 2, oldpolicy, &oldsz,
+ policy, strlen(policy) + 1) == -1)
logmsg(LOG_INFO, "cannot set hw.perfpolicy");
if (setlo == 1) {
@@ -653,7 +654,7 @@ setperfpolicy(char *policy)
int perf;
int new_perf = 0;
size_t perf_sz = sizeof(perf);
- if (sysctl(hw_perf_mib, 2, &perf, &perf_sz, &new_perf, perf_sz) < 0)
+ if (sysctl(hw_perf_mib, 2, &perf, &perf_sz, &new_perf, perf_sz) == -1)
logmsg(LOG_INFO, "cannot set hw.setperf");
}
}
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index f2ef04aa133..cfbbcc4b218 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.82 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: arp.c,v 1.83 2019/06/28 13:32:46 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -245,9 +245,9 @@ getsocket(void)
if (rtsock >= 0)
return;
rtsock = socket(AF_ROUTE, SOCK_RAW, 0);
- if (rtsock < 0)
+ if (rtsock == -1)
err(1, "routing socket");
- if (setsockopt(rtsock, AF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) < 0)
+ if (setsockopt(rtsock, AF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) == -1)
err(1, "ROUTE_TABLEFILTER");
if (pledge("stdio dns", NULL) == -1)
@@ -664,7 +664,7 @@ doit:
l = rtm->rtm_msglen;
rtm->rtm_seq = ++seq;
rtm->rtm_type = cmd;
- if (write(rtsock, (char *)&m_rtmsg, l) < 0)
+ if (write(rtsock, (char *)&m_rtmsg, l) == -1)
if (errno != ESRCH || cmd != RTM_DELETE) {
warn("writing to routing socket");
return (-1);
diff --git a/usr.sbin/authpf/authpf.c b/usr.sbin/authpf/authpf.c
index f8039ab0891..97cbadd3c48 100644
--- a/usr.sbin/authpf/authpf.c
+++ b/usr.sbin/authpf/authpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authpf.c,v 1.127 2018/04/26 12:42:51 guenther Exp $ */
+/* $OpenBSD: authpf.c,v 1.128 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (C) 1998 - 2007 Bob Beck (beck@openbsd.org).
@@ -641,7 +641,7 @@ remove_stale_rulesets(void)
memset(&prs, 0, sizeof(prs));
strlcpy(prs.path, anchorname, sizeof(prs.path));
- if (ioctl(dev, DIOCGETRULESETS, &prs)) {
+ if (ioctl(dev, DIOCGETRULESETS, &prs) == -1) {
if (errno == EINVAL)
return (0);
else
@@ -654,7 +654,7 @@ remove_stale_rulesets(void)
pid_t pid;
prs.nr = nr - 1;
- if (ioctl(dev, DIOCGETRULESET, &prs))
+ if (ioctl(dev, DIOCGETRULESET, &prs) == -1)
return (1);
errno = 0;
if ((t = strchr(prs.name, '(')) == NULL)
@@ -694,8 +694,8 @@ recursive_ruleset_purge(char *an, char *rs)
snprintf(t_e[0].anchor, sizeof(t_e[0].anchor), "%s/%s", an, rs);
t_e[1].type = PF_TRANS_TABLE;
- if ((ioctl(dev, DIOCXBEGIN, t) ||
- ioctl(dev, DIOCXCOMMIT, t)) &&
+ if ((ioctl(dev, DIOCXBEGIN, t) == -1||
+ ioctl(dev, DIOCXCOMMIT, t) == -1) &&
errno != EINVAL)
goto cleanup;
@@ -703,7 +703,7 @@ recursive_ruleset_purge(char *an, char *rs)
if ((prs = calloc(1, sizeof(struct pfioc_ruleset))) == NULL)
goto no_mem;
snprintf(prs->path, sizeof(prs->path), "%s/%s", an, rs);
- if (ioctl(dev, DIOCGETRULESETS, prs)) {
+ if (ioctl(dev, DIOCGETRULESETS, prs) == -1) {
if (errno != EINVAL)
goto cleanup;
errno = 0;
@@ -712,7 +712,7 @@ recursive_ruleset_purge(char *an, char *rs)
while (nr) {
prs->nr = 0;
- if (ioctl(dev, DIOCGETRULESET, prs))
+ if (ioctl(dev, DIOCGETRULESET, prs) == -1)
goto cleanup;
if (recursive_ruleset_purge(prs->path, prs->name))
@@ -870,7 +870,7 @@ change_table(int add, const char *ipsrc)
return (-1);
}
- if (ioctl(dev, add ? DIOCRADDADDRS : DIOCRDELADDRS, &io) &&
+ if (ioctl(dev, add ? DIOCRADDADDRS : DIOCRDELADDRS, &io) == -1 &&
errno != ESRCH) {
syslog(LOG_ERR, "cannot %s %s from table %s: %s",
add ? "add" : "remove", ipsrc, tablename,
@@ -910,7 +910,7 @@ authpf_kill_states(void)
sizeof(psk.psk_src.addr.v.a.addr));
memset(&psk.psk_src.addr.v.a.mask, 0xff,
sizeof(psk.psk_src.addr.v.a.mask));
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
syslog(LOG_ERR, "DIOCKILLSTATES failed (%m)");
/* Kill all states to ipsrc */
@@ -919,7 +919,7 @@ authpf_kill_states(void)
sizeof(psk.psk_dst.addr.v.a.addr));
memset(&psk.psk_dst.addr.v.a.mask, 0xff,
sizeof(psk.psk_dst.addr.v.a.mask));
- if (ioctl(dev, DIOCKILLSTATES, &psk))
+ if (ioctl(dev, DIOCKILLSTATES, &psk) == -1)
syslog(LOG_ERR, "DIOCKILLSTATES failed (%m)");
}
diff --git a/usr.sbin/bgpd/pftable.c b/usr.sbin/bgpd/pftable.c
index 418af987204..b584ae259fc 100644
--- a/usr.sbin/bgpd/pftable.c
+++ b/usr.sbin/bgpd/pftable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pftable.c,v 1.12 2018/11/25 15:31:12 deraadt Exp $ */
+/* $OpenBSD: pftable.c,v 1.13 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2004 Damien Miller <djm@openbsd.org>
@@ -97,7 +97,7 @@ pftable_clear(const char *name)
strlcpy(tio.pfrio_table.pfrt_name, name,
sizeof(tio.pfrio_table.pfrt_name));
- if (ioctl(devpf, DIOCRCLRADDRS, &tio) != 0) {
+ if (ioctl(devpf, DIOCRCLRADDRS, &tio) == -1) {
log_warn("pftable_clear ioctl");
return (-1);
}
@@ -121,7 +121,7 @@ pftable_exists(const char *name)
tio.pfrio_esize = sizeof(dummy);
tio.pfrio_size = 1;
- if (ioctl(devpf, DIOCRGETASTATS, &tio) != 0)
+ if (ioctl(devpf, DIOCRGETASTATS, &tio) == -1)
return (-1);
return (0);
diff --git a/usr.sbin/config/exec_elf.c b/usr.sbin/config/exec_elf.c
index 14e020f61bf..12be811ae7a 100644
--- a/usr.sbin/config/exec_elf.c
+++ b/usr.sbin/config/exec_elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.c,v 1.16 2017/10/29 08:45:53 mpi Exp $ */
+/* $OpenBSD: exec_elf.c,v 1.17 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 1999 Mats O Jansson. All rights reserved.
@@ -97,7 +97,7 @@ loadkernel(char *file)
{
int fd;
- if ((fd = open(file, O_RDONLY | O_EXLOCK, 0)) < 0)
+ if ((fd = open(file, O_RDONLY | O_EXLOCK, 0)) == -1)
err(1, "%s", file);
if (read(fd, (char *)&elf_ex, sizeof(elf_ex)) != sizeof(elf_ex))
@@ -140,7 +140,7 @@ savekernel(char *outfile)
{
int fd;
- if ((fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0700)) < 0)
+ if ((fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0700)) == -1)
err(1, "%s", outfile);
if (write(fd, elf_total, (size_t)elf_size) != elf_size)
diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c
index 411d06f3308..d03eee04dbb 100644
--- a/usr.sbin/cron/atrun.c
+++ b/usr.sbin/cron/atrun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atrun.c,v 1.49 2019/01/25 00:19:27 millert Exp $ */
+/* $OpenBSD: atrun.c,v 1.50 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2002-2003 Todd C. Miller <millert@openbsd.org>
@@ -264,7 +264,7 @@ run_job(const atjob *job, int dfd, const char *atfile)
char *nargv[2], *nenvp[1];
/* Open the file and unlink it so we don't try running it again. */
- if ((fd = openat(dfd, atfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) < 0) {
+ if ((fd = openat(dfd, atfile, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) {
syslog(LOG_ERR, "(CRON) CAN'T OPEN (%s)", atfile);
return;
}
@@ -310,7 +310,7 @@ run_job(const atjob *job, int dfd, const char *atfile)
}
/* Sanity checks */
- if (fstat(fd, &sb) < 0) {
+ if (fstat(fd, &sb) == -1) {
syslog(LOG_ERR, "(%s) FSTAT FAILED (%s)", pw->pw_name, atfile);
_exit(EXIT_FAILURE);
}
@@ -424,7 +424,7 @@ run_job(const atjob *job, int dfd, const char *atfile)
syslog(LOG_INFO, "(%s) ATJOB (%s)", pw->pw_name, atfile);
/* Connect grandchild's stdin to the at job file. */
- if (lseek(fd, 0, SEEK_SET) < 0) {
+ if (lseek(fd, 0, SEEK_SET) == -1) {
syslog(LOG_ERR, "(CRON) LSEEK (%m)");
_exit(EXIT_FAILURE);
}
diff --git a/usr.sbin/cron/crontab.c b/usr.sbin/cron/crontab.c
index d22aae2538d..6e9933af6cc 100644
--- a/usr.sbin/cron/crontab.c
+++ b/usr.sbin/cron/crontab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crontab.c,v 1.92 2016/01/11 14:23:50 millert Exp $ */
+/* $OpenBSD: crontab.c,v 1.93 2019/06/28 13:32:47 deraadt Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -199,11 +199,11 @@ parse_args(int argc, char *argv[])
* the race.
*/
- if (setegid(user_gid) < 0)
+ if (setegid(user_gid) == -1)
err(EXIT_FAILURE, "setegid(user_gid)");
if (!(NewCrontab = fopen(Filename, "r")))
err(EXIT_FAILURE, "%s", Filename);
- if (setegid(crontab_gid) < 0)
+ if (setegid(crontab_gid) == -1)
err(EXIT_FAILURE, "setegid(crontab_gid)");
}
}
@@ -279,7 +279,7 @@ edit_cmd(void)
err(EXIT_FAILURE, _PATH_DEVNULL);
}
- if (fstat(fileno(f), &statbuf) < 0) {
+ if (fstat(fileno(f), &statbuf) == -1) {
warn("fstat");
goto fatal;
}
@@ -310,7 +310,7 @@ edit_cmd(void)
copy_crontab(f, NewCrontab);
fclose(f);
- if (fflush(NewCrontab) < 0)
+ if (fflush(NewCrontab) == EOF)
err(EXIT_FAILURE, "%s", Filename);
if (futimens(t, ts) == -1)
warn("unable to set times on %s", Filename);
@@ -335,7 +335,7 @@ edit_cmd(void)
goto fatal;
}
- if (fstat(t, &statbuf) < 0) {
+ if (fstat(t, &statbuf) == -1) {
warn("fstat");
goto fatal;
}
diff --git a/usr.sbin/cron/database.c b/usr.sbin/cron/database.c
index e399d74f4c4..2a38a61af94 100644
--- a/usr.sbin/cron/database.c
+++ b/usr.sbin/cron/database.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: database.c,v 1.37 2018/02/05 03:52:37 millert Exp $ */
+/* $OpenBSD: database.c,v 1.38 2019/06/28 13:32:47 deraadt Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -58,14 +58,14 @@ load_database(cron_db **db)
* so that if anything changes as of this moment (i.e., before we've
* cached any of the database), we'll see the changes next time.
*/
- if (stat(_PATH_CRON_SPOOL, &statbuf) < 0) {
+ if (stat(_PATH_CRON_SPOOL, &statbuf) == -1) {
syslog(LOG_ERR, "(CRON) STAT FAILED (%s)", _PATH_CRON_SPOOL);
return;
}
/* track system crontab file
*/
- if (stat(_PATH_SYS_CRONTAB, &syscron_stat) < 0)
+ if (stat(_PATH_SYS_CRONTAB, &syscron_stat) == -1)
timespecclear(&syscron_stat.st_mtim);
/* hash mtime of system crontab file and crontab dir
@@ -184,7 +184,7 @@ process_crontab(int dfd, const char *uname, const char *fname,
}
fd = openat(dfd, fname, O_RDONLY|O_NONBLOCK|O_NOFOLLOW|O_CLOEXEC);
- if (fd < 0) {
+ if (fd == -1) {
/* crontab not accessible?
*/
syslog(LOG_ERR, "(%s) CAN'T OPEN (%s)", uname, fname);
@@ -196,7 +196,7 @@ process_crontab(int dfd, const char *uname, const char *fname,
goto next_crontab;
}
- if (fstat(fileno(crontab_fp), statbuf) < 0) {
+ if (fstat(fileno(crontab_fp), statbuf) == -1) {
syslog(LOG_ERR, "(%s) FSTAT FAILED (%s)", uname, fname);
goto next_crontab;
}
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index 12cc66cc876..c0e6c5dcc90 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.59 2018/06/13 13:30:03 tb Exp $ */
+/* $OpenBSD: do_command.c,v 1.60 2019/06/28 13:32:47 deraadt Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
@@ -206,7 +206,7 @@ child_process(entry *e, user *u)
e->pwd->pw_name);
_exit(EXIT_FAILURE);
}
- if (setusercontext(lc, e->pwd, e->pwd->pw_uid, LOGIN_SETALL) < 0) {
+ if (setusercontext(lc, e->pwd, e->pwd->pw_uid, LOGIN_SETALL) == -1) {
warn("setusercontext failed for %s", e->pwd->pw_name);
syslog(LOG_ERR, "(%s) SETUSERCONTEXT FAILED (%m)",
e->pwd->pw_name);
@@ -425,7 +425,7 @@ child_process(entry *e, user *u)
*/
int waiter;
if (jobpid > 0) {
- while (waitpid(jobpid, &waiter, 0) < 0 && errno == EINTR)
+ while (waitpid(jobpid, &waiter, 0) == -1 && errno == EINTR)
;
/* If everything went well, and -n was set, _and_ we have mail,
@@ -462,7 +462,7 @@ child_process(entry *e, user *u)
}
if (stdinjob > 0)
- while (waitpid(stdinjob, &waiter, 0) < 0 && errno == EINTR)
+ while (waitpid(stdinjob, &waiter, 0) == -1 && errno == EINTR)
;
}
diff --git a/usr.sbin/cron/popen.c b/usr.sbin/cron/popen.c
index f156095d837..81da171d321 100644
--- a/usr.sbin/cron/popen.c
+++ b/usr.sbin/cron/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.30 2015/11/15 23:24:24 millert Exp $ */
+/* $OpenBSD: popen.c,v 1.31 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -75,7 +75,7 @@ cron_popen(char *program, char *type, struct passwd *pw, pid_t *pidptr)
if ((*type != 'r' && *type != 'w') || type[1] != '\0')
return (NULL);
- if (pipe(pdes) < 0)
+ if (pipe(pdes) == -1)
return (NULL);
/* break up string into pieces */
@@ -92,7 +92,7 @@ cron_popen(char *program, char *type, struct passwd *pw, pid_t *pidptr)
/* NOTREACHED */
case 0: /* child */
if (pw) {
- if (setusercontext(0, pw, pw->pw_uid, LOGIN_SETALL) < 0) {
+ if (setusercontext(0, pw, pw->pw_uid, LOGIN_SETALL) == -1) {
syslog(LOG_ERR,
"(%s) SETUSERCONTEXT FAILED (%m)",
pw->pw_name);
@@ -145,10 +145,10 @@ cron_pclose(FILE *iop, pid_t pid)
sigaddset(&sigset, SIGQUIT);
sigaddset(&sigset, SIGHUP);
sigprocmask(SIG_BLOCK, &sigset, &osigset);
- while ((rv = waitpid(pid, &status, 0)) < 0 && errno == EINTR)
+ while ((rv = waitpid(pid, &status, 0)) == -1 && errno == EINTR)
continue;
sigprocmask(SIG_SETMASK, &osigset, NULL);
- if (rv < 0)
+ if (rv == -1)
return (rv);
if (WIFEXITED(status))
return (WEXITSTATUS(status));
diff --git a/usr.sbin/dhcpd/pfutils.c b/usr.sbin/dhcpd/pfutils.c
index 091f372d5f5..48db8c6faa8 100644
--- a/usr.sbin/dhcpd/pfutils.c
+++ b/usr.sbin/dhcpd/pfutils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfutils.c,v 1.19 2018/12/07 12:52:47 henning Exp $ */
+/* $OpenBSD: pfutils.c,v 1.20 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
*
@@ -154,7 +154,7 @@ pf_change_table(int fd, int op, struct in_addr ip, char *table)
addr.pfra_af = AF_INET;
addr.pfra_net = 32;
- if (ioctl(fd, op ? DIOCRADDADDRS : DIOCRDELADDRS, &io) &&
+ if (ioctl(fd, op ? DIOCRADDADDRS : DIOCRDELADDRS, &io) == -1 &&
errno != ESRCH) {
log_warn( "DIOCR%sADDRS on table %s", op ? "ADD" : "DEL",
table);
@@ -178,7 +178,7 @@ pf_kill_state(int fd, struct in_addr ip)
sizeof(psk.psk_src.addr.v.a.addr));
memset(&psk.psk_src.addr.v.a.mask, 0xff,
sizeof(psk.psk_src.addr.v.a.mask));
- if (ioctl(fd, DIOCKILLSTATES, &psk)) {
+ if (ioctl(fd, DIOCKILLSTATES, &psk) == -1) {
log_warn("DIOCKILLSTATES failed");
}
@@ -188,7 +188,7 @@ pf_kill_state(int fd, struct in_addr ip)
sizeof(psk.psk_dst.addr.v.a.addr));
memset(&psk.psk_dst.addr.v.a.mask, 0xff,
sizeof(psk.psk_dst.addr.v.a.mask));
- if (ioctl(fd, DIOCKILLSTATES, &psk)) {
+ if (ioctl(fd, DIOCKILLSTATES, &psk) == -1) {
log_warn("DIOCKILLSTATES failed");
}
}
diff --git a/usr.sbin/dhcpd/udpsock.c b/usr.sbin/dhcpd/udpsock.c
index 6f50d4712b2..ff7e4a32bdc 100644
--- a/usr.sbin/dhcpd/udpsock.c
+++ b/usr.sbin/dhcpd/udpsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udpsock.c,v 1.10 2017/02/13 22:33:39 krw Exp $ */
+/* $OpenBSD: udpsock.c,v 1.11 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2014 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -58,7 +58,7 @@ udpsock_startup(struct in_addr bindaddr)
fatal("could not create udpsock");
memset(&sin4, 0, sizeof(sin4));
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
fatal("creating a socket failed for udp");
onoff = 1;
@@ -115,7 +115,7 @@ udpsock_handler(struct protocol *protocol)
m.msg_controllen = sizeof(cbuf);
memset(&iface, 0, sizeof(iface));
- if ((len = recvmsg(udpsock->sock, &m, 0)) < 0) {
+ if ((len = recvmsg(udpsock->sock, &m, 0)) == -1) {
log_warn("receiving a DHCP message failed");
return;
}
@@ -137,12 +137,12 @@ udpsock_handler(struct protocol *protocol)
}
if_indextoname(sdl->sdl_index, ifname);
- if ((sockio = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ if ((sockio = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
log_warn("socket creation failed");
return;
}
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- if (ioctl(sockio, SIOCGIFADDR, &ifr, sizeof(ifr)) != 0) {
+ if (ioctl(sockio, SIOCGIFADDR, &ifr, sizeof(ifr)) == -1) {
log_warn("Failed to get address for %s", ifname);
close(sockio);
return;
diff --git a/usr.sbin/dvmrpd/interface.c b/usr.sbin/dvmrpd/interface.c
index 76bf469d749..33156463fa9 100644
--- a/usr.sbin/dvmrpd/interface.c
+++ b/usr.sbin/dvmrpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.11 2015/09/27 17:29:46 stsp Exp $ */
+/* $OpenBSD: interface.c,v 1.12 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -182,7 +182,7 @@ if_new(struct kif *kif)
/* set up ifreq */
strlcpy(ifr->ifr_name, kif->ifname, sizeof(ifr->ifr_name));
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
err(1, "if_new: socket");
/* get type */
@@ -201,20 +201,20 @@ if_new(struct kif *kif)
iface->baudrate = kif->baudrate;
/* get address */
- if (ioctl(s, SIOCGIFADDR, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFADDR, (caddr_t)ifr) == -1)
err(1, "if_new: cannot get address");
sain = (struct sockaddr_in *) &ifr->ifr_addr;
iface->addr = sain->sin_addr;
/* get mask */
- if (ioctl(s, SIOCGIFNETMASK, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFNETMASK, (caddr_t)ifr) == -1)
err(1, "if_new: cannot get mask");
sain = (struct sockaddr_in *) &ifr->ifr_addr;
iface->mask = sain->sin_addr;
/* get p2p dst address */
if (iface->type == IF_TYPE_POINTOPOINT) {
- if (ioctl(s, SIOCGIFDSTADDR, (caddr_t)ifr) < 0)
+ if (ioctl(s, SIOCGIFDSTADDR, (caddr_t)ifr) == -1)
err(1, "if_new: cannot get dst addr");
sain = (struct sockaddr_in *) &ifr->ifr_addr;
iface->dst = sain->sin_addr;
@@ -513,7 +513,7 @@ int
if_set_mcast_ttl(int fd, u_int8_t ttl)
{
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *)&ttl, sizeof(ttl)) < 0) {
+ (char *)&ttl, sizeof(ttl)) == -1) {
log_warn("if_set_mcast_ttl: error setting "
"IP_MULTICAST_TTL to %d", ttl);
return (-1);
@@ -526,7 +526,7 @@ int
if_set_tos(int fd, int tos)
{
if (setsockopt(fd, IPPROTO_IP, IP_TOS,
- (int *)&tos, sizeof(tos)) < 0) {
+ (int *)&tos, sizeof(tos)) == -1) {
log_warn("if_set_tos: error setting IP_TOS to 0x%x", tos);
return (-1);
}
@@ -557,7 +557,7 @@ if_join_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_debug("if_join_group: error IP_ADD_MEMBERSHIP, "
"interface %s", iface->name);
return (-1);
@@ -582,7 +582,7 @@ if_leave_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_debug("if_leave_group: error IP_DROP_MEMBERSHIP, "
"interface %s", iface->name);
return (-1);
@@ -603,7 +603,7 @@ if_set_mcast(struct iface *iface)
case IF_TYPE_BROADCAST:
if (setsockopt(iface->fd, IPPROTO_IP, IP_MULTICAST_IF,
(char *)&iface->addr.s_addr,
- sizeof(iface->addr.s_addr)) < 0) {
+ sizeof(iface->addr.s_addr)) == -1) {
log_debug("if_set_mcast: error setting "
"IP_MULTICAST_IF, interface %s", iface->name);
return (-1);
@@ -622,7 +622,7 @@ if_set_mcast_loop(int fd)
u_int8_t loop = 0;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0) {
+ (char *)&loop, sizeof(loop)) == -1) {
log_warn("if_set_mcast_loop: error setting IP_MULTICAST_LOOP");
return (-1);
}
diff --git a/usr.sbin/dvmrpd/kmroute.c b/usr.sbin/dvmrpd/kmroute.c
index 891f630e27a..8a811ac2182 100644
--- a/usr.sbin/dvmrpd/kmroute.c
+++ b/usr.sbin/dvmrpd/kmroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kmroute.c,v 1.2 2010/05/26 13:56:07 nicm Exp $ */
+/* $OpenBSD: kmroute.c,v 1.3 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -153,7 +153,7 @@ mrt_init(int fd)
int flag = 1;
if (setsockopt(fd, IPPROTO_IP, MRT_INIT, &flag,
- sizeof(flag)) < 0) {
+ sizeof(flag)) == -1) {
log_warn("mrt_init: error setting MRT_INIT");
return (-1);
}
@@ -167,7 +167,7 @@ mrt_done(int fd)
int flag = 0;
if (setsockopt(fd, IPPROTO_IP, MRT_DONE, &flag,
- sizeof(flag)) < 0) {
+ sizeof(flag)) == -1) {
log_warn("mrt_done: error setting MRT_DONE");
return (-1);
}
@@ -188,7 +188,7 @@ mrt_add_vif(int fd, struct iface *iface)
vc.vifc_rmt_addr.s_addr = 0;
if (setsockopt(fd, IPPROTO_IP, MRT_ADD_VIF, &vc,
- sizeof(vc)) < 0) {
+ sizeof(vc)) == -1) {
log_warn("mrt_add_vif: error adding VIF");
return (-1);
}
@@ -204,7 +204,7 @@ mrt_del_vif(int fd, struct iface *iface)
vifi = iface->ifindex;
if (setsockopt(fd, IPPROTO_IP, MRT_DEL_VIF, &vifi,
- sizeof(vifi)) < 0)
+ sizeof(vifi)) == -1)
log_warn("mrt_del_vif: error deleting VIF");
}
@@ -226,7 +226,7 @@ mrt_add_mfc(int fd, struct mfc *mfc)
}
if (setsockopt(fd, IPPROTO_IP, MRT_ADD_MFC, &mc, sizeof(mc))
- < 0) {
+ == -1) {
log_warnx("mrt_add_mfc: error adding group %s to interface %d",
inet_ntoa(mfc->group), mfc->ifindex);
return (-1);
@@ -246,7 +246,7 @@ mrt_del_mfc(int fd, struct mfc *mfc)
mc.mfcc_mcastgrp = mfc->group;
if (setsockopt(fd, IPPROTO_IP, MRT_DEL_MFC, &mc, sizeof(mc))
- < 0) {
+ == -1) {
log_warnx("mrt_del_mfc: error deleting group %s ",
inet_ntoa(mfc->group));
return (-1);
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c
index 402c5511424..69ab46ecfae 100644
--- a/usr.sbin/edquota/edquota.c
+++ b/usr.sbin/edquota/edquota.c
@@ -266,9 +266,9 @@ getprivs(u_int id, int quotatype)
"group %s not known, skipping %s\n",
quotagroup, fs->fs_file);
}
- if ((fd = open(qfpathname, O_RDONLY)) < 0) {
+ if ((fd = open(qfpathname, O_RDONLY)) == -1) {
fd = open(qfpathname, O_RDWR|O_CREAT, 0640);
- if (fd < 0 && errno != ENOENT) {
+ if (fd == -1 && errno != ENOENT) {
perror(qfpathname);
free(qup);
continue;
@@ -327,7 +327,7 @@ putprivs(long id, int quotatype, struct quotause *quplist)
for (qup = quplist; qup; qup = qup->next) {
if (quotactl(qup->fsname, qcmd, id, (char *)&qup->dqblk) == 0)
continue;
- if ((fd = open(qup->qfname, O_WRONLY)) < 0) {
+ if ((fd = open(qup->qfname, O_WRONLY)) == -1) {
perror(qup->qfname);
} else {
lseek(fd, (off_t)(id * sizeof (struct dqblk)), SEEK_SET);
diff --git a/usr.sbin/eeprom/ophandlers.c b/usr.sbin/eeprom/ophandlers.c
index 751fb68a294..cf695e7f6c7 100644
--- a/usr.sbin/eeprom/ophandlers.c
+++ b/usr.sbin/eeprom/ophandlers.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ophandlers.c,v 1.14 2015/08/20 22:39:29 deraadt Exp $ */
+/* $OpenBSD: ophandlers.c,v 1.15 2019/06/28 13:32:47 deraadt Exp $ */
/* $NetBSD: ophandlers.c,v 1.2 1996/02/28 01:13:30 thorpej Exp $ */
/*-
@@ -79,7 +79,7 @@ op_handler(char *keyword, char *arg)
char opio_buf[BUFSIZE];
int fd, optnode;
- if ((fd = open(path_openprom, arg ? O_RDWR : O_RDONLY, 0640)) < 0)
+ if ((fd = open(path_openprom, arg ? O_RDWR : O_RDONLY, 0640)) == -1)
BARF(path_openprom, strerror(errno));
/* Check to see if it's a special-case keyword. */
@@ -87,7 +87,7 @@ op_handler(char *keyword, char *arg)
if (strcmp(ex->ex_keyword, keyword) == 0)
break;
- if (ioctl(fd, OPIOCGETOPTNODE, (char *)&optnode) < 0)
+ if (ioctl(fd, OPIOCGETOPTNODE, (char *)&optnode) == -1)
BARF("OPIOCGETOPTNODE", strerror(errno));
bzero(&opio_buf[0], sizeof(opio_buf));
@@ -102,7 +102,7 @@ op_handler(char *keyword, char *arg)
opio.op_buf = &opio_buf[0];
opio.op_buflen = sizeof(opio_buf);
- if (ioctl(fd, OPIOCGET, (char *)&opio) < 0)
+ if (ioctl(fd, OPIOCGET, (char *)&opio) == -1)
BARF("OPIOCGET", strerror(errno));
if (opio.op_buflen <= 0) {
@@ -123,7 +123,7 @@ op_handler(char *keyword, char *arg)
opio.op_buflen = strlen(arg);
}
- if (ioctl(fd, OPIOCSET, (char *)&opio) < 0)
+ if (ioctl(fd, OPIOCSET, (char *)&opio) == -1)
BARF("invalid keyword", keyword);
if (verbose) {
@@ -136,7 +136,7 @@ op_handler(char *keyword, char *arg)
} else {
opio.op_buf = &opio_buf[0];
opio.op_buflen = sizeof(opio_buf);
- if (ioctl(fd, OPIOCGET, (char *)&opio) < 0)
+ if (ioctl(fd, OPIOCGET, (char *)&opio) == -1)
BARF("OPIOCGET", strerror(errno));
if (opio.op_buflen <= 0) {
@@ -178,10 +178,10 @@ op_dump(void)
char buf1[BUFSIZE], buf2[BUFSIZE], buf3[BUFSIZE], buf4[BUFSIZE];
int fd, optnode;
- if ((fd = open(path_openprom, O_RDONLY, 0640)) < 0)
+ if ((fd = open(path_openprom, O_RDONLY, 0640)) == -1)
err(1, "open: %s", path_openprom);
- if (ioctl(fd, OPIOCGETOPTNODE, (char *)&optnode) < 0)
+ if (ioctl(fd, OPIOCGETOPTNODE, (char *)&optnode) == -1)
err(1, "OPIOCGETOPTNODE");
bzero(&opio1, sizeof(opio1));
@@ -213,7 +213,7 @@ op_dump(void)
opio1.op_namelen = strlen(opio1.op_name);
opio1.op_buflen = sizeof(buf2);
- if (ioctl(fd, OPIOCNEXTPROP, (char *)&opio1) < 0)
+ if (ioctl(fd, OPIOCNEXTPROP, (char *)&opio1) == -1)
err(1, "ioctl: OPIOCNEXTPROP");
/*
@@ -233,7 +233,7 @@ op_dump(void)
bzero(opio2.op_buf, sizeof(buf4));
opio2.op_buflen = sizeof(buf4);
- if (ioctl(fd, OPIOCGET, (char *)&opio2) < 0)
+ if (ioctl(fd, OPIOCGET, (char *)&opio2) == -1)
err(1, "ioctl: OPIOCGET");
for (ex = opextab; ex->ex_keyword != NULL; ++ex)
diff --git a/usr.sbin/eeprom/optree.c b/usr.sbin/eeprom/optree.c
index 25b5c7257be..2d47123a95b 100644
--- a/usr.sbin/eeprom/optree.c
+++ b/usr.sbin/eeprom/optree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: optree.c,v 1.9 2017/10/20 10:32:03 kettenis Exp $ */
+/* $OpenBSD: optree.c,v 1.10 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2007 Federico G. Schwindt <fgsch@openbsd.org>
@@ -120,7 +120,7 @@ op_nodes(int fd, int node, int depth)
opio.op_name = op_name;
if (!node) {
- if (ioctl(fd, OPIOCGETNEXT, &opio) < 0)
+ if (ioctl(fd, OPIOCGETNEXT, &opio) == -1)
err(1, "OPIOCGETNEXT");
node = opio.op_nodeid;
} else
@@ -133,7 +133,7 @@ op_nodes(int fd, int node, int depth)
opio.op_namelen = sizeof(op_name);
/* Get the next property. */
- if (ioctl(fd, OPIOCNEXTPROP, &opio) < 0)
+ if (ioctl(fd, OPIOCNEXTPROP, &opio) == -1)
err(1, "OPIOCNEXTPROP");
op_buf[opio.op_buflen] = '\0';
@@ -148,7 +148,7 @@ op_nodes(int fd, int node, int depth)
opio.op_buflen = sizeof(op_buf);
/* And its value. */
- if (ioctl(fd, OPIOCGET, &opio) < 0) {
+ if (ioctl(fd, OPIOCGET, &opio) == -1) {
if (errno != ENOMEM)
err(1, "OPIOCGET");
@@ -159,14 +159,14 @@ op_nodes(int fd, int node, int depth)
}
/* Get next child. */
- if (ioctl(fd, OPIOCGETCHILD, &opio) < 0)
+ if (ioctl(fd, OPIOCGETCHILD, &opio) == -1)
err(1, "OPIOCGETCHILD");
if (opio.op_nodeid)
op_nodes(fd, opio.op_nodeid, depth + 1);
/* Get next node/sibling. */
opio.op_nodeid = node;
- if (ioctl(fd, OPIOCGETNEXT, &opio) < 0)
+ if (ioctl(fd, OPIOCGETNEXT, &opio) == -1)
err(1, "OPIOCGETNEXT");
if (opio.op_nodeid)
op_nodes(fd, opio.op_nodeid, depth);
@@ -177,7 +177,7 @@ op_tree(void)
{
int fd;
- if ((fd = open(path_openprom, O_RDONLY, 0640)) < 0)
+ if ((fd = open(path_openprom, O_RDONLY, 0640)) == -1)
err(1, "open: %s", path_openprom);
op_nodes(fd, 0, 0);
(void)close(fd);
diff --git a/usr.sbin/eigrpd/interface.c b/usr.sbin/eigrpd/interface.c
index 6075cc93cad..438805e2edd 100644
--- a/usr.sbin/eigrpd/interface.c
+++ b/usr.sbin/eigrpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.24 2017/02/22 14:24:50 renato Exp $ */
+/* $OpenBSD: interface.c,v 1.25 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -562,7 +562,7 @@ if_join_ipv4_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = if_primary_addr(iface);
if (setsockopt(global.eigrp_socket_v4, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IP_ADD_MEMBERSHIP, interface %s address %s",
__func__, iface->name, inet_ntoa(*addr));
return (-1);
@@ -587,7 +587,7 @@ if_leave_ipv4_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = if_primary_addr(iface);
if (setsockopt(global.eigrp_socket_v4, IPPROTO_IP, IP_DROP_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IP_DROP_MEMBERSHIP, interface %s "
"address %s", iface->name, __func__, inet_ntoa(*addr));
return (-1);
@@ -600,7 +600,7 @@ int
if_set_ipv4_mcast_ttl(int fd, uint8_t ttl)
{
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *)&ttl, sizeof(ttl)) < 0) {
+ (char *)&ttl, sizeof(ttl)) == -1) {
log_warn("%s: error setting IP_MULTICAST_TTL to %d",
__func__, ttl);
return (-1);
@@ -617,7 +617,7 @@ if_set_ipv4_mcast(struct iface *iface)
addr = if_primary_addr(iface);
if (setsockopt(global.eigrp_socket_v4, IPPROTO_IP, IP_MULTICAST_IF,
- &addr, sizeof(addr)) < 0) {
+ &addr, sizeof(addr)) == -1) {
log_warn("%s: error setting IP_MULTICAST_IF, interface %s",
__func__, iface->name);
return (-1);
@@ -632,7 +632,7 @@ if_set_ipv4_mcast_loop(int fd)
uint8_t loop = 0;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0) {
+ (char *)&loop, sizeof(loop)) == -1) {
log_warn("%s: error setting IP_MULTICAST_LOOP", __func__);
return (-1);
}
@@ -644,7 +644,7 @@ int
if_set_ipv4_recvif(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("%s: error setting IP_RECVIF", __func__);
return (-1);
}
@@ -656,7 +656,7 @@ if_set_ipv4_hdrincl(int fd)
{
int hincl = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) == -1) {
log_warn("%s: error setting IP_HDRINCL", __func__);
return (-1);
}
@@ -680,7 +680,7 @@ if_join_ipv6_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(global.eigrp_socket_v6, IPPROTO_IPV6, IPV6_JOIN_GROUP,
- &mreq, sizeof(mreq)) < 0) {
+ &mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IPV6_JOIN_GROUP, interface %s address %s",
__func__, iface->name, log_in6addr(addr));
return (-1);
@@ -705,7 +705,7 @@ if_leave_ipv6_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(global.eigrp_socket_v6, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IPV6_LEAVE_GROUP, interface %s address %s",
__func__, iface->name, log_in6addr(addr));
return (-1);
@@ -718,7 +718,7 @@ int
if_set_ipv6_mcast(struct iface *iface)
{
if (setsockopt(global.eigrp_socket_v6, IPPROTO_IPV6, IPV6_MULTICAST_IF,
- &iface->ifindex, sizeof(iface->ifindex)) < 0) {
+ &iface->ifindex, sizeof(iface->ifindex)) == -1) {
log_warn("%s: error setting IPV6_MULTICAST_IF, interface %s",
__func__, iface->name);
return (-1);
@@ -733,7 +733,7 @@ if_set_ipv6_mcast_loop(int fd)
unsigned int loop = 0;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- (unsigned int *)&loop, sizeof(loop)) < 0) {
+ (unsigned int *)&loop, sizeof(loop)) == -1) {
log_warn("%s: error setting IPV6_MULTICAST_LOOP", __func__);
return (-1);
}
@@ -745,7 +745,7 @@ int
if_set_ipv6_pktinfo(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("%s: error setting IPV6_RECVPKTINFO", __func__);
return (-1);
}
@@ -757,7 +757,7 @@ int
if_set_ipv6_dscp(int fd, int dscp)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &dscp,
- sizeof(dscp)) < 0) {
+ sizeof(dscp)) == -1) {
log_warn("%s: error setting IPV6_TCLASS", __func__);
return (-1);
}
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c
index ebc2f7188a6..2b1603c3779 100644
--- a/usr.sbin/fdformat/fdformat.c
+++ b/usr.sbin/fdformat/fdformat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdformat.c,v 1.23 2018/09/17 15:44:16 jmc Exp $ */
+/* $OpenBSD: fdformat.c,v 1.24 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (C) 1992-1994 by Joerg Wunsch, Dresden
@@ -88,7 +88,7 @@ format_track(int fd, int cyl, int secs, int head, int rate, int gaplen,
f.fd_formb_secno(i) = il[i+1];
f.fd_formb_secsize(i) = secsize;
}
- if (ioctl(fd, FD_FORM, (caddr_t)&f) < 0)
+ if (ioctl(fd, FD_FORM, (caddr_t)&f) == -1)
err(1, "FD_FORM");
}
@@ -99,7 +99,7 @@ verify_track(int fd, int track, int tracksize)
static int bufsz = 0;
int fdopts = -1, ofdopts, rv = 0;
- if (ioctl(fd, FD_GOPTS, &fdopts) < 0)
+ if (ioctl(fd, FD_GOPTS, &fdopts) == -1)
warn("FD_GOPTS");
else {
ofdopts = fdopts;
@@ -118,7 +118,7 @@ verify_track(int fd, int track, int tracksize)
fprintf (stderr, "\nfdformat: out of memory\n");
exit (2);
}
- if (lseek (fd, (off_t) track*tracksize, SEEK_SET) < 0)
+ if (lseek (fd, (off_t) track*tracksize, SEEK_SET) == -1)
rv = -1;
/* try twice reading it, without using the normal retrier */
else if (read (fd, buf, tracksize) != tracksize
@@ -243,10 +243,10 @@ main(int argc, char *argv[])
if (optind != argc - 1)
usage();
- if ((fd = opendev(argv[optind], O_RDWR, OPENDEV_PART, &devname)) < 0)
+ if ((fd = opendev(argv[optind], O_RDWR, OPENDEV_PART, &devname)) == -1)
err(1, "%s", devname);
- if (ioctl(fd, FD_GTYPE, &fdt) < 0)
+ if (ioctl(fd, FD_GTYPE, &fdt) == -1)
errx(1, "not a floppy disk: %s", devname);
switch (rate) {
diff --git a/usr.sbin/ftp-proxy/ftp-proxy.c b/usr.sbin/ftp-proxy/ftp-proxy.c
index 611bb6b02f9..d986d27fd76 100644
--- a/usr.sbin/ftp-proxy/ftp-proxy.c
+++ b/usr.sbin/ftp-proxy/ftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp-proxy.c,v 1.36 2016/09/26 17:15:19 jca Exp $ */
+/* $OpenBSD: ftp-proxy.c,v 1.37 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -394,7 +394,7 @@ handle_connection(const int listen_fd, short event, void *arg)
*/
client_sa = sstosa(&tmp_ss);
len = sizeof(struct sockaddr_storage);
- if ((client_fd = accept(listen_fd, client_sa, &len)) < 0) {
+ if ((client_fd = accept(listen_fd, client_sa, &len)) == -1) {
logmsg(LOG_CRIT, "accept() failed: %s", strerror(errno));
/*
@@ -444,7 +444,7 @@ handle_connection(const int listen_fd, short event, void *arg)
* Find out the real server and port that the client wanted.
*/
len = sizeof(struct sockaddr_storage);
- if (getsockname(s->client_fd, server_sa, &len) < 0) {
+ if (getsockname(s->client_fd, server_sa, &len) == -1) {
logmsg(LOG_CRIT, "#%d getsockname failed: %s", s->id,
strerror(errno));
goto fail;
@@ -468,7 +468,7 @@ handle_connection(const int listen_fd, short event, void *arg)
* Setup socket and connect to server.
*/
if ((s->server_fd = socket(server_sa->sa_family, SOCK_STREAM,
- IPPROTO_TCP)) < 0) {
+ IPPROTO_TCP)) == -1) {
logmsg(LOG_CRIT, "#%d server socket failed: %s", s->id,
strerror(errno));
goto fail;
@@ -487,7 +487,7 @@ handle_connection(const int listen_fd, short event, void *arg)
s->id, strerror(errno));
goto fail;
}
- if (connect(s->server_fd, server_sa, server_sa->sa_len) < 0 &&
+ if (connect(s->server_fd, server_sa, server_sa->sa_len) == -1 &&
errno != EINPROGRESS) {
logmsg(LOG_CRIT, "#%d proxy cannot connect to server %s: %s",
s->id, sock_ntop(server_sa), strerror(errno));
@@ -495,7 +495,7 @@ handle_connection(const int listen_fd, short event, void *arg)
}
len = sizeof(struct sockaddr_storage);
- if ((getsockname(s->server_fd, proxy_to_server_sa, &len)) < 0) {
+ if ((getsockname(s->server_fd, proxy_to_server_sa, &len)) == -1) {
logmsg(LOG_CRIT, "#%d getsockname failed: %s", s->id,
strerror(errno));
goto fail;
@@ -905,7 +905,7 @@ proxy_reply(int cmd, struct sockaddr *sa, u_int16_t port)
break;
}
- if (r < 0 || r >= sizeof linebuf) {
+ if (r == -1 || r >= sizeof linebuf) {
logmsg(LOG_ERR, "proxy_reply failed: %d", r);
linebuf[0] = '\0';
linelen = 0;
diff --git a/usr.sbin/hostapd/hostapd.c b/usr.sbin/hostapd/hostapd.c
index 2808d3f57e1..49085569573 100644
--- a/usr.sbin/hostapd/hostapd.c
+++ b/usr.sbin/hostapd/hostapd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostapd.c,v 1.39 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: hostapd.c,v 1.40 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -281,7 +281,7 @@ hostapd_udp_init(struct hostapd_config *cfg)
"%s: %s\n", IAPP_MCASTADDR, strerror(errno));
if (setsockopt(iapp->i_udp, IPPROTO_IP, IP_MULTICAST_TTL,
- &iapp->i_ttl, sizeof(iapp->i_ttl)) < 0)
+ &iapp->i_ttl, sizeof(iapp->i_ttl)) == -1)
hostapd_fatal("failed to set multicast ttl to "
"%u: %s\n", iapp->i_ttl, strerror(errno));
diff --git a/usr.sbin/hostapd/privsep.c b/usr.sbin/hostapd/privsep.c
index 5144e267cb5..83de6d8a468 100644
--- a/usr.sbin/hostapd/privsep.c
+++ b/usr.sbin/hostapd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.26 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: privsep.c,v 1.27 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
@@ -107,7 +107,7 @@ hostapd_priv_init(struct hostapd_config *cfg)
if (socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, socks) == -1)
hostapd_fatal("failed to get socket pair\n");
- if ((child_pid = fork()) < 0)
+ if ((child_pid = fork()) == -1)
hostapd_fatal("failed to fork child process\n");
/*
@@ -287,7 +287,7 @@ hostapd_priv(int fd, short sig, void *arg)
SIOCS80211NODE : SIOCS80211DELNODE;
/* Try to add/delete a station from the APME */
- if ((ret = ioctl(cfg->c_apme_ctl, request, &nr)) != 0)
+ if ((ret = ioctl(cfg->c_apme_ctl, request, &nr)) == -1)
ret = errno;
hostapd_must_write(fd, &ret, sizeof(int));
diff --git a/usr.sbin/hostapd/roaming.c b/usr.sbin/hostapd/roaming.c
index 9d43112445d..43848953d5f 100644
--- a/usr.sbin/hostapd/roaming.c
+++ b/usr.sbin/hostapd/roaming.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roaming.c,v 1.7 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: roaming.c,v 1.8 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -172,7 +172,7 @@ hostapd_roaming_addr(struct hostapd_apme *apme, struct hostapd_inaddr *addr,
}
(void)strlcpy(ifra.ifra_name, apme->a_iface, sizeof(ifra.ifra_name));
- if (ioctl(cfg->c_apme_ctl, SIOCDIFADDR, &ifra) < 0) {
+ if (ioctl(cfg->c_apme_ctl, SIOCDIFADDR, &ifra) == -1) {
if (errno != EADDRNOTAVAIL) {
hostapd_log(HOSTAPD_LOG_VERBOSE,
"%s/%s: failed to delete address %s",
@@ -181,7 +181,7 @@ hostapd_roaming_addr(struct hostapd_apme *apme, struct hostapd_inaddr *addr,
return (errno);
}
}
- if (add && ioctl(cfg->c_apme_ctl, SIOCAIFADDR, &ifra) < 0) {
+ if (add && ioctl(cfg->c_apme_ctl, SIOCAIFADDR, &ifra) == -1) {
if (errno != EEXIST) {
hostapd_log(HOSTAPD_LOG_VERBOSE,
"%s/%s: failed to add address %s",
diff --git a/usr.sbin/hostctl/hostctl.c b/usr.sbin/hostctl/hostctl.c
index dbaf1eb0d6c..f0639dd55f3 100644
--- a/usr.sbin/hostctl/hostctl.c
+++ b/usr.sbin/hostctl/hostctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostctl.c,v 1.4 2018/07/03 16:42:51 sf Exp $ */
+/* $OpenBSD: hostctl.c,v 1.5 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2016 Reyk Floeter <reyk@openbsd.org>
@@ -143,7 +143,7 @@ main(int argc, char *argv[])
err(1, "calloc");
if (tflag) {
- if (ioctl(fd, PVBUSIOC_TYPE, &pvr, sizeof(pvr)) != 0)
+ if (ioctl(fd, PVBUSIOC_TYPE, &pvr, sizeof(pvr)) == -1)
err(1, "ioctl");
/* The returned type should be a simple single-line key */
@@ -184,7 +184,7 @@ main(int argc, char *argv[])
err(1, "open: %s", path_pvbus);
}
- if ((ret = ioctl(fd, cmd, &pvr, sizeof(pvr))) != 0)
+ if ((ret = ioctl(fd, cmd, &pvr, sizeof(pvr))) == -1)
err(1, "ioctl");
if (!qflag && strlen(pvr.pvr_value)) {
diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y
index ead70654e87..054302269f4 100644
--- a/usr.sbin/httpd/parse.y
+++ b/usr.sbin/httpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.112 2019/05/08 19:57:45 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.113 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -2338,7 +2338,7 @@ is_if_in_group(const char *ifname, const char *groupname)
int s;
int ret = 0;
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
memset(&ifgr, 0, sizeof(ifgr));
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index daedde16551..577c9c7150e 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.118 2019/02/19 11:37:26 pirofti Exp $ */
+/* $OpenBSD: server.c,v 1.119 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -821,7 +821,7 @@ server_tls_readcb(int fd, short event, void *arg)
ret = tls_read(clt->clt_tls_ctx, rbuf, howmuch);
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) {
goto retry;
- } else if (ret < 0) {
+ } else if (ret == -1) {
what |= EVBUFFER_ERROR;
goto err;
}
@@ -881,7 +881,7 @@ server_tls_writecb(int fd, short event, void *arg)
EVBUFFER_LENGTH(bufev->output));
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) {
goto retry;
- } else if (ret < 0) {
+ } else if (ret == -1) {
what |= EVBUFFER_ERROR;
goto err;
}
diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c
index c35984c479f..225f5aaa9e0 100644
--- a/usr.sbin/ifstated/ifstated.c
+++ b/usr.sbin/ifstated/ifstated.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifstated.c,v 1.63 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: ifstated.c,v 1.64 2019/06/28 13:32:47 deraadt Exp $ */
/*
* Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org>
@@ -148,7 +148,7 @@ main(int argc, char *argv[])
log_init(debug, LOG_DAEMON);
log_setverbose(opts & IFSD_OPT_VERBOSE);
- if ((rt_fd = socket(AF_ROUTE, SOCK_RAW, 0)) < 0)
+ if ((rt_fd = socket(AF_ROUTE, SOCK_RAW, 0)) == -1)
fatal("no routing socket");
rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_IFANNOUNCE);
@@ -328,7 +328,7 @@ external_exec(struct ifsd_external *external, int async)
argp[2] = external->command;
log_debug("running %s", external->command);
pid = fork();
- if (pid < 0) {
+ if (pid == -1) {
log_warn("fork error");
} else if (pid == 0) {
execv(_PATH_BSHELL, argp);
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index a5372aaae12..4627ef81148 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.160 2018/10/15 11:29:27 florian Exp $ */
+/* $OpenBSD: inetd.c,v 1.161 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -356,7 +356,7 @@ main(int argc, char *argv[])
openlog("inetd", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
- if (getrlimit(RLIMIT_NOFILE, &rlim_nofile) < 0) {
+ if (getrlimit(RLIMIT_NOFILE, &rlim_nofile) == -1) {
syslog(LOG_ERR, "getrlimit: %m");
} else {
rlim_nofile_cur = rlim_nofile.rlim_cur;
@@ -399,7 +399,7 @@ gettcp(int fd, short events, void *xsep)
ctrl = accept(sep->se_fd, NULL, NULL);
if (debug)
fprintf(stderr, "accept, ctrl %d\n", ctrl);
- if (ctrl < 0) {
+ if (ctrl == -1) {
if (errno != EWOULDBLOCK && errno != EINTR &&
errno != ECONNABORTED)
syslog(LOG_WARNING, "accept (for %s): %m",
@@ -412,7 +412,7 @@ gettcp(int fd, short events, void *xsep)
socklen_t plen = sizeof(peer);
char sbuf[NI_MAXSERV];
- if (getpeername(ctrl, (struct sockaddr *)&peer, &plen) < 0) {
+ if (getpeername(ctrl, (struct sockaddr *)&peer, &plen) == -1) {
syslog(LOG_WARNING, "could not getpeername");
close(ctrl);
return;
@@ -484,7 +484,7 @@ dg_broadcast(struct in_addr *in)
struct ifaddrs *ifa, *ifap;
struct sockaddr_in *sin;
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
return (0);
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (ifa->ifa_addr->sa_family != AF_INET ||
@@ -814,7 +814,7 @@ setup(struct servtab *sep)
int r;
mode_t mask = 0;
- if ((sep->se_fd = socket(sep->se_family, sep->se_socktype, 0)) < 0) {
+ if ((sep->se_fd = socket(sep->se_family, sep->se_socktype, 0)) == -1) {
syslog(LOG_ERR, "%s/%s: socket: %m",
sep->se_service, sep->se_proto);
return;
@@ -862,7 +862,7 @@ setsockopt(fd, SOL_SOCKET, opt, &on, sizeof (on))
if (sep->se_family == AF_UNIX)
umask(mask);
}
- if (r < 0) {
+ if (r == -1) {
syslog(LOG_ERR, "%s/%s: bind: %m",
sep->se_service, sep->se_proto);
(void) close(sep->se_fd);
@@ -906,7 +906,7 @@ register_rpc(struct servtab *sep)
return;
}
n = sizeof sin;
- if (getsockname(sep->se_fd, (struct sockaddr *)&sin, &n) < 0) {
+ if (getsockname(sep->se_fd, (struct sockaddr *)&sin, &n) == -1) {
syslog(LOG_ERR, "%s/%s: getsockname: %m",
sep->se_service, sep->se_proto);
return;
@@ -1115,7 +1115,7 @@ more:
/* check if the family is supported */
s = socket(sep->se_family, SOCK_DGRAM, 0);
- if (s < 0) {
+ if (s == -1) {
syslog(LOG_WARNING, "%s/%s: %s: the address family is "
"not supported by the kernel", sep->se_service,
sep->se_proto, sep->se_hostaddr);
@@ -1412,7 +1412,7 @@ bump_nofile(void)
struct rlimit rl;
- if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
+ if (getrlimit(RLIMIT_NOFILE, &rl) == -1) {
syslog(LOG_ERR, "getrlimit: %m");
return -1;
}
@@ -1425,7 +1425,7 @@ bump_nofile(void)
return -1;
}
- if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
+ if (setrlimit(RLIMIT_NOFILE, &rl) == -1) {
syslog(LOG_ERR, "setrlimit: %m");
return -1;
}
@@ -1462,7 +1462,7 @@ echo_dg(int s, struct servtab *sep)
size = sizeof(ss);
if ((i = recvfrom(s, buffer, sizeof(buffer), 0,
- (struct sockaddr *)&ss, &size)) < 0)
+ (struct sockaddr *)&ss, &size)) == -1)
return;
if (dg_badinput((struct sockaddr *)&ss))
return;
@@ -1553,7 +1553,7 @@ chargen_dg(int s, struct servtab *sep)
size = sizeof(ss);
if (recvfrom(s, text, sizeof(text), 0, (struct sockaddr *)&ss,
- &size) < 0)
+ &size) == -1)
return;
if (dg_badinput((struct sockaddr *)&ss))
return;
@@ -1583,7 +1583,7 @@ machtime(void)
{
struct timeval tv;
- if (gettimeofday(&tv, NULL) < 0)
+ if (gettimeofday(&tv, NULL) == -1)
return (0L);
return (htonl((u_int32_t)tv.tv_sec + 2208988800UL));
@@ -1607,7 +1607,7 @@ machtime_dg(int s, struct servtab *sep)
size = sizeof(ss);
if (recvfrom(s, &result, sizeof(result), 0,
- (struct sockaddr *)&ss, &size) < 0)
+ (struct sockaddr *)&ss, &size) == -1)
return;
if (dg_badinput((struct sockaddr *)&ss))
return;
@@ -1642,7 +1642,7 @@ daytime_dg(int s, struct servtab *sep)
size = sizeof(ss);
if (recvfrom(s, buffer, sizeof(buffer), 0, (struct sockaddr *)&ss,
- &size) < 0)
+ &size) == -1)
return;
if (dg_badinput((struct sockaddr *)&ss))
return;
@@ -1739,7 +1739,7 @@ spawn(int ctrl, short events, void *xsep)
}
pid = fork();
}
- if (pid < 0) {
+ if (pid == -1) {
syslog(LOG_ERR, "fork: %m");
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
close(ctrl);
@@ -1791,7 +1791,7 @@ spawn(int ctrl, short events, void *xsep)
tmpint |= LOGIN_SETGROUP;
}
if (setusercontext(NULL, pwd, pwd->pw_uid,
- tmpint) < 0) {
+ tmpint) == -1) {
syslog(LOG_ERR,
"%s/%s: setusercontext: %m",
sep->se_service, sep->se_proto);
diff --git a/usr.sbin/installboot/armv7_installboot.c b/usr.sbin/installboot/armv7_installboot.c
index 7242fbf00db..5e16f436605 100644
--- a/usr.sbin/installboot/armv7_installboot.c
+++ b/usr.sbin/installboot/armv7_installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: armv7_installboot.c,v 1.3 2017/05/07 10:40:17 kettenis Exp $ */
+/* $OpenBSD: armv7_installboot.c,v 1.4 2019/06/28 13:32:48 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -73,7 +73,7 @@ md_installboot(int devfd, char *dev)
int part;
/* Get and check disklabel. */
- if (ioctl(devfd, DIOCGDINFO, &dl) != 0)
+ if (ioctl(devfd, DIOCGDINFO, &dl) == -1)
err(1, "disklabel: %s", dev);
if (dl.d_magic != DISKMAGIC)
errx(1, "bad disklabel magic=0x%08x", dl.d_magic);
diff --git a/usr.sbin/installboot/bootstrap.c b/usr.sbin/installboot/bootstrap.c
index 4a957cc26e5..19332ff487d 100644
--- a/usr.sbin/installboot/bootstrap.c
+++ b/usr.sbin/installboot/bootstrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootstrap.c,v 1.12 2018/12/13 14:06:10 krw Exp $ */
+/* $OpenBSD: bootstrap.c,v 1.13 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2013 Joel Sing <jsing@openbsd.org>
@@ -60,9 +60,9 @@ bootstrap(int devfd, char *dev, char *bootfile)
if (verbose)
fprintf(stderr, "reading bootstrap from %s\n", bootfile);
fd = open(bootfile, O_RDONLY);
- if (fd < 0)
+ if (fd == -1)
err(1, "open %s", bootfile);
- if (fstat(fd, &sb) != 0)
+ if (fstat(fd, &sb) == -1)
err(1, "fstat %s", bootfile);
bootsec = howmany((ssize_t)sb.st_size, dl.d_secsize);
bootsize = bootsec * dl.d_secsize;
diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c
index 2f55a410001..8ff7b09a9b6 100644
--- a/usr.sbin/installboot/i386_installboot.c
+++ b/usr.sbin/installboot/i386_installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_installboot.c,v 1.31 2017/10/27 16:47:08 mpi Exp $ */
+/* $OpenBSD: i386_installboot.c,v 1.32 2019/06/28 13:32:48 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -130,7 +130,7 @@ md_installboot(int devfd, char *dev)
int part;
/* Get and check disklabel. */
- if (ioctl(devfd, DIOCGDINFO, &dl) != 0)
+ if (ioctl(devfd, DIOCGDINFO, &dl) == -1)
err(1, "disklabel: %s", dev);
if (dl.d_magic != DISKMAGIC)
errx(1, "bad disklabel magic=0x%08x", dl.d_magic);
@@ -171,7 +171,7 @@ write_bootblocks(int devfd, char *dev, struct disklabel *dl)
u_int start = 0;
/* Write patched proto bootblock(s) into the superblock. */
- if (fstat(devfd, &sb) < 0)
+ if (fstat(devfd, &sb) == -1)
err(1, "fstat: %s", dev);
if (!S_ISCHR(sb.st_mode))
@@ -592,7 +592,7 @@ loadproto(char *fname, long *size)
Elf_Word phsize;
Elf_Phdr *ph;
- if ((fd = open(fname, O_RDONLY)) < 0)
+ if ((fd = open(fname, O_RDONLY)) == -1)
err(1, "%s", fname);
if (read(fd, &eh, sizeof(eh)) != sizeof(eh))
@@ -680,10 +680,10 @@ getbootparams(char *boot, int devfd, struct disklabel *dl)
/* Make sure the (probably new) boot file is on disk. */
sync(); sleep(1);
- if ((fd = open(boot, O_RDONLY)) < 0)
+ if ((fd = open(boot, O_RDONLY)) == -1)
err(1, "open: %s", boot);
- if (fstatfs(fd, &fssb) != 0)
+ if (fstatfs(fd, &fssb) == -1)
err(1, "statfs: %s", boot);
if (strncmp(fssb.f_fstypename, "ffs", MFSNAMELEN) &&
diff --git a/usr.sbin/installboot/i386_nlist.c b/usr.sbin/installboot/i386_nlist.c
index d4daf443204..cdb0695d2e5 100644
--- a/usr.sbin/installboot/i386_nlist.c
+++ b/usr.sbin/installboot/i386_nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_nlist.c,v 1.6 2017/10/27 16:47:08 mpi Exp $ */
+/* $OpenBSD: i386_nlist.c,v 1.7 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -109,7 +109,7 @@ __elf_fdnlist(int fd, struct nlist *list)
/* Make sure obj is OK */
if (pread(fd, &ehdr, sizeof(Elf_Ehdr), (off_t)0) != sizeof(Elf_Ehdr) ||
- !__elf_is_okay__(&ehdr) || fstat(fd, &st) < 0)
+ !__elf_is_okay__(&ehdr) || fstat(fd, &st) == -1)
return (-1);
/* calculate section header table size */
@@ -301,7 +301,7 @@ nlist_elf32(const char *name, struct nlist *list)
int fd, n;
fd = open(name, O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
return (-1);
n = __elf_fdnlist(fd, list);
close(fd);
diff --git a/usr.sbin/installboot/i386_softraid.c b/usr.sbin/installboot/i386_softraid.c
index 4e8bbe26e7e..8790db06806 100644
--- a/usr.sbin/installboot/i386_softraid.c
+++ b/usr.sbin/installboot/i386_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_softraid.c,v 1.10 2016/04/28 16:48:18 krw Exp $ */
+/* $OpenBSD: i386_softraid.c,v 1.11 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
@@ -73,11 +73,11 @@ sr_install_bootblk(int devfd, int vol, int disk)
/* Open this device and check its disklabel. */
if ((diskfd = opendev(bd.bd_vendor, (nowrite? O_RDONLY:O_RDWR),
- OPENDEV_PART, &dev)) < 0)
+ OPENDEV_PART, &dev)) == -1)
err(1, "open: %s", dev);
/* Get and check disklabel. */
- if (ioctl(diskfd, DIOCGDINFO, &dl) != 0)
+ if (ioctl(diskfd, DIOCGDINFO, &dl) == -1)
err(1, "disklabel: %s", dev);
if (dl.d_magic != DISKMAGIC)
err(1, "bad disklabel magic=0x%08x", dl.d_magic);
diff --git a/usr.sbin/installboot/installboot.c b/usr.sbin/installboot/installboot.c
index 905e49b90f4..f79176bd154 100644
--- a/usr.sbin/installboot/installboot.c
+++ b/usr.sbin/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.11 2015/11/29 00:14:07 deraadt Exp $ */
+/* $OpenBSD: installboot.c,v 1.12 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org>
@@ -98,7 +98,7 @@ main(int argc, char **argv)
}
if ((devfd = opendev(dev, (nowrite ? O_RDONLY : O_RDWR), OPENDEV_PART,
- &realdev)) < 0)
+ &realdev)) == -1)
err(1, "open: %s", realdev);
if (verbose) {
diff --git a/usr.sbin/installboot/sparc64_installboot.c b/usr.sbin/installboot/sparc64_installboot.c
index 1932476cb29..bef2079a8af 100644
--- a/usr.sbin/installboot/sparc64_installboot.c
+++ b/usr.sbin/installboot/sparc64_installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sparc64_installboot.c,v 1.7 2015/12/28 23:00:29 krw Exp $ */
+/* $OpenBSD: sparc64_installboot.c,v 1.8 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2012, 2013 Joel Sing <jsing@openbsd.org>
@@ -55,7 +55,7 @@ md_loadboot(void)
int fd;
/* Load first-stage boot block. */
- if ((fd = open(stage1, O_RDONLY)) < 0)
+ if ((fd = open(stage1, O_RDONLY)) == -1)
err(1, "open");
if (fstat(fd, &sb) == -1)
err(1, "fstat");
@@ -76,7 +76,7 @@ md_loadboot(void)
close(fd);
/* Load second-stage boot loader. */
- if ((fd = open(stage2, O_RDONLY)) < 0)
+ if ((fd = open(stage2, O_RDONLY)) == -1)
err(1, "open");
if (fstat(fd, &sb) == -1)
err(1, "stat");
diff --git a/usr.sbin/installboot/sparc64_softraid.c b/usr.sbin/installboot/sparc64_softraid.c
index 148b7c80bdf..776cf4a646a 100644
--- a/usr.sbin/installboot/sparc64_softraid.c
+++ b/usr.sbin/installboot/sparc64_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sparc64_softraid.c,v 1.3 2015/10/03 16:56:52 krw Exp $ */
+/* $OpenBSD: sparc64_softraid.c,v 1.4 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
@@ -64,7 +64,7 @@ sr_install_bootblk(int devfd, int vol, int disk)
/* Open device. */
if ((diskfd = opendev(bd.bd_vendor, (nowrite ? O_RDONLY : O_RDWR),
- OPENDEV_PART, &realdev)) < 0)
+ OPENDEV_PART, &realdev)) == -1)
err(1, "open: %s", realdev);
if (verbose)
diff --git a/usr.sbin/kgmon/kgmon.c b/usr.sbin/kgmon/kgmon.c
index 70c7929b301..cafab0f2285 100644
--- a/usr.sbin/kgmon/kgmon.c
+++ b/usr.sbin/kgmon/kgmon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kgmon.c,v 1.25 2018/04/26 12:42:51 guenther Exp $ */
+/* $OpenBSD: kgmon.c,v 1.26 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
@@ -188,7 +188,7 @@ openfiles(char *sys, char *kmemf, struct kvmvars *kvp, int cpuid)
mib[2] = GPROF_STATE;
mib[3] = cpuid;
size = sizeof state;
- if (sysctl(mib, 4, &state, &size, NULL, 0) < 0)
+ if (sysctl(mib, 4, &state, &size, NULL, 0) == -1)
errx(20, "profiling not defined in kernel.");
if (!(bflag || hflag || rflag ||
(pflag && state == GMON_PROF_ON)))
@@ -210,7 +210,7 @@ openfiles(char *sys, char *kmemf, struct kvmvars *kvp, int cpuid)
errx(2, "kvm_openfiles: %s", errbuf);
kern_readonly(GMON_PROF_ON);
}
- if (kvm_nlist(kvp->kd, nl) < 0)
+ if (kvm_nlist(kvp->kd, nl) == -1)
errx(3, "%s: no namelist", sys ? sys : _PATH_UNIX);
if (!nl[N_GMONPARAM].n_value)
errx(20, "profiling not defined in kernel.");
@@ -255,7 +255,7 @@ getprof(struct kvmvars *kvp, int cpuid)
mib[2] = GPROF_GMONPARAM;
mib[3] = cpuid;
size = sizeof kvp->gpm;
- if (sysctl(mib, 4, &kvp->gpm, &size, NULL, 0) < 0)
+ if (sysctl(mib, 4, &kvp->gpm, &size, NULL, 0) == -1)
size = 0;
}
if (size != sizeof kvp->gpm)
@@ -280,7 +280,7 @@ setprof(struct kvmvars *kvp, int cpuid, int state)
mib[1] = KERN_PROF;
mib[2] = GPROF_STATE;
mib[3] = cpuid;
- if (sysctl(mib, 4, &oldstate, &sz, NULL, 0) < 0)
+ if (sysctl(mib, 4, &oldstate, &sz, NULL, 0) == -1)
goto bad;
if (oldstate == state)
return;
@@ -345,7 +345,7 @@ dumpstate(struct kvmvars *kvp, int cpuid)
mib[2] = GPROF_COUNT;
mib[3] = cpuid;
i = kvp->gpm.kcountsize;
- if (sysctl(mib, 4, tickbuf, &i, NULL, 0) < 0)
+ if (sysctl(mib, 4, tickbuf, &i, NULL, 0) == -1)
i = 0;
}
if (i != kvp->gpm.kcountsize)
@@ -368,7 +368,7 @@ dumpstate(struct kvmvars *kvp, int cpuid)
mib[2] = GPROF_FROMS;
mib[3] = cpuid;
i = kvp->gpm.fromssize;
- if (sysctl(mib, 4, froms, &i, NULL, 0) < 0)
+ if (sysctl(mib, 4, froms, &i, NULL, 0) == -1)
i = 0;
}
if (i != kvp->gpm.fromssize)
@@ -384,7 +384,7 @@ dumpstate(struct kvmvars *kvp, int cpuid)
mib[2] = GPROF_TOS;
mib[3] = cpuid;
i = kvp->gpm.tossize;
- if (sysctl(mib, 4, tos, &i, NULL, 0) < 0)
+ if (sysctl(mib, 4, tos, &i, NULL, 0) == -1)
i = 0;
}
if (i != kvp->gpm.tossize)
@@ -435,7 +435,7 @@ getprofhz(struct kvmvars *kvp)
mib[1] = KERN_CLOCKRATE;
clockrate.profhz = 1;
size = sizeof clockrate;
- if (sysctl(mib, 2, &clockrate, &size, NULL, 0) < 0)
+ if (sysctl(mib, 2, &clockrate, &size, NULL, 0) == -1)
warn("get clockrate");
return (clockrate.profhz);
}
@@ -476,13 +476,13 @@ reset(struct kvmvars *kvp, int cpuid)
mib[1] = KERN_PROF;
mib[2] = GPROF_COUNT;
mib[3] = cpuid;
- if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.kcountsize) < 0)
+ if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.kcountsize) == -1)
err(13, "tickbuf zero");
mib[2] = GPROF_FROMS;
- if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.fromssize) < 0)
+ if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.fromssize) == -1)
err(14, "froms zero");
mib[2] = GPROF_TOS;
- if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.tossize) < 0)
+ if (sysctl(mib, 4, NULL, NULL, zbuf, kvp->gpm.tossize) == -1)
err(15, "tos zero");
free(zbuf);
}
@@ -495,7 +495,7 @@ getncpu(void)
int ncpu;
size = sizeof(ncpu);
- if (sysctl(mib, 2, &ncpu, &size, NULL, 0) < 0) {
+ if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) {
warnx("cannot read hw.ncpu");
return (1);
}
diff --git a/usr.sbin/kvm_mkdb/kvm_mkdb.c b/usr.sbin/kvm_mkdb/kvm_mkdb.c
index 64765679058..bda0080948e 100644
--- a/usr.sbin/kvm_mkdb/kvm_mkdb.c
+++ b/usr.sbin/kvm_mkdb/kvm_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_mkdb.c,v 1.30 2018/10/26 17:11:33 mestre Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.31 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -85,7 +85,7 @@ main(int argc, char *argv[])
/* Increase our data size to the max if we can. */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ if (setrlimit(RLIMIT_DATA, &rl) == -1)
warn("can't set rlimit data size");
}
diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c
index 7745642103e..cd8c01b3bad 100644
--- a/usr.sbin/kvm_mkdb/nlist.c
+++ b/usr.sbin/kvm_mkdb/nlist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nlist.c,v 1.52 2018/04/26 12:42:51 guenther Exp $ */
+/* $OpenBSD: nlist.c,v 1.53 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -90,7 +90,7 @@ __elf_knlist(int fd, DB *db, int ksyms)
errx(1, "cannot allocate %zu bytes for symbol header",
sizeof(Elf_Shdr) * eh.e_shnum);
- if (fseek (fp, eh.e_shoff, SEEK_SET) < 0) {
+ if (fseek(fp, eh.e_shoff, SEEK_SET) == -1) {
fmterr = "no exec header";
error = -1;
goto done;
diff --git a/usr.sbin/kvm_mkdb/testdb.c b/usr.sbin/kvm_mkdb/testdb.c
index a804634e61c..649a7d1c4f9 100644
--- a/usr.sbin/kvm_mkdb/testdb.c
+++ b/usr.sbin/kvm_mkdb/testdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: testdb.c,v 1.9 2015/01/16 06:40:17 deraadt Exp $ */
+/* $OpenBSD: testdb.c,v 1.10 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@ testdb(char *dbname)
mib[0] = CTL_KERN;
mib[1] = KERN_VERSION;
kversionlen = sizeof(kversion);
- if (sysctl(mib, 2, kversion, &kversionlen, NULL, 0) < 0)
+ if (sysctl(mib, 2, kversion, &kversionlen, NULL, 0) == -1)
goto close;
/* Read the version out of the database */
diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c
index 268fd6bddee..a494d304b27 100644
--- a/usr.sbin/ldapd/ldape.c
+++ b/usr.sbin/ldapd/ldape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldape.c,v 1.30 2018/08/12 22:04:09 rob Exp $ */
+/* $OpenBSD: ldape.c,v 1.31 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se>
@@ -381,7 +381,7 @@ ldape(int debug, int verbose, char *csockpath)
TAILQ_FOREACH(l, &conf->listeners, entry) {
l->fd = socket(l->ss.ss_family, SOCK_STREAM | SOCK_NONBLOCK,
0);
- if (l->fd < 0)
+ if (l->fd == -1)
fatal("ldape: socket");
setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
diff --git a/usr.sbin/ldpd/interface.c b/usr.sbin/ldpd/interface.c
index c5796bb3c60..01324f9726a 100644
--- a/usr.sbin/ldpd/interface.c
+++ b/usr.sbin/ldpd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.50 2017/03/03 23:41:27 renato Exp $ */
+/* $OpenBSD: interface.c,v 1.51 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -460,7 +460,7 @@ if_join_ipv4_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = if_get_ipv4_addr(iface);
if (setsockopt(global.ipv4.ldp_disc_socket, IPPROTO_IP,
- IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
+ IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IP_ADD_MEMBERSHIP, interface %s address %s",
__func__, iface->name, inet_ntoa(*addr));
return (-1);
@@ -480,7 +480,7 @@ if_leave_ipv4_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = if_get_ipv4_addr(iface);
if (setsockopt(global.ipv4.ldp_disc_socket, IPPROTO_IP,
- IP_DROP_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
+ IP_DROP_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IP_DROP_MEMBERSHIP, interface %s "
"address %s", __func__, iface->name, inet_ntoa(*addr));
return (-1);
@@ -501,7 +501,7 @@ if_join_ipv6_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(global.ipv6.ldp_disc_socket, IPPROTO_IPV6,
- IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) < 0) {
+ IPV6_JOIN_GROUP, &mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IPV6_JOIN_GROUP, interface %s address %s",
__func__, iface->name, log_in6addr(addr));
return (-1);
@@ -522,7 +522,7 @@ if_leave_ipv6_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(global.ipv6.ldp_disc_socket, IPPROTO_IPV6,
- IPV6_LEAVE_GROUP, (void *)&mreq, sizeof(mreq)) < 0) {
+ IPV6_LEAVE_GROUP, (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("%s: error IPV6_LEAVE_GROUP, interface %s address %s",
__func__, iface->name, log_in6addr(addr));
return (-1);
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index afc1f8f4dd3..ec550143be6 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.69 2019/01/23 08:43:45 dlg Exp $ */
+/* $OpenBSD: kroute.c,v 1.70 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2015, 2016 Renato Westphal <renato@openbsd.org>
@@ -1835,7 +1835,7 @@ kmpw_install(const char *ifname, struct kpw *kpw)
memset(&ifr, 0, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t) &imr;
- if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr)) {
+ if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
log_warn("ioctl SIOCSETMPWCFG");
return (-1);
}
@@ -1853,7 +1853,7 @@ kmpw_uninstall(const char *ifname)
memset(&imr, 0, sizeof(imr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t) &imr;
- if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr)) {
+ if (ioctl(kr_state.ioctl_fd, SIOCSETMPWCFG, &ifr) == -1) {
log_warn("ioctl SIOCSETMPWCFG");
return (-1);
}
diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c
index e41b922b403..cf47e3406dc 100644
--- a/usr.sbin/ldpd/neighbor.c
+++ b/usr.sbin/ldpd/neighbor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: neighbor.c,v 1.80 2019/01/23 02:02:04 dlg Exp $ */
+/* $OpenBSD: neighbor.c,v 1.81 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -547,7 +547,7 @@ nbr_connect_cb(int fd, short event, void *arg)
socklen_t len;
len = sizeof(error);
- if (getsockopt(nbr->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0) {
+ if (getsockopt(nbr->fd, SOL_SOCKET, SO_ERROR, &error, &len) == -1) {
log_warn("%s: getsockopt SOL_SOCKET SO_ERROR", __func__);
return;
}
diff --git a/usr.sbin/ldpd/socket.c b/usr.sbin/ldpd/socket.c
index e161099426b..60fbb9c1b35 100644
--- a/usr.sbin/ldpd/socket.c
+++ b/usr.sbin/ldpd/socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket.c,v 1.9 2016/07/01 23:29:55 renato Exp $ */
+/* $OpenBSD: socket.c,v 1.10 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2016 Renato Westphal <renato@openbsd.org>
@@ -195,7 +195,7 @@ int
sock_set_reuse(int fd, int enable)
{
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &enable,
- sizeof(int)) < 0) {
+ sizeof(int)) == -1) {
log_warn("%s: error setting SO_REUSEADDR", __func__);
return (-1);
}
@@ -207,7 +207,7 @@ int
sock_set_bindany(int fd, int enable)
{
if (setsockopt(fd, SOL_SOCKET, SO_BINDANY, &enable,
- sizeof(int)) < 0) {
+ sizeof(int)) == -1) {
log_warn("%s: error setting SO_BINDANY", __func__);
return (-1);
}
@@ -218,7 +218,7 @@ sock_set_bindany(int fd, int enable)
int
sock_set_ipv4_tos(int fd, int tos)
{
- if (setsockopt(fd, IPPROTO_IP, IP_TOS, (int *)&tos, sizeof(tos)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_TOS, (int *)&tos, sizeof(tos)) == -1) {
log_warn("%s: error setting IP_TOS to 0x%x", __func__, tos);
return (-1);
}
@@ -230,7 +230,7 @@ int
sock_set_ipv4_recvif(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("%s: error setting IP_RECVIF", __func__);
return (-1);
}
@@ -240,7 +240,7 @@ sock_set_ipv4_recvif(int fd, int enable)
int
sock_set_ipv4_minttl(int fd, int ttl)
{
- if (setsockopt(fd, IPPROTO_IP, IP_MINTTL, &ttl, sizeof(ttl)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_MINTTL, &ttl, sizeof(ttl)) == -1) {
log_warn("%s: error setting IP_MINTTL", __func__);
return (-1);
}
@@ -251,7 +251,7 @@ sock_set_ipv4_minttl(int fd, int ttl)
int
sock_set_ipv4_ucast_ttl(int fd, int ttl)
{
- if (setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl)) == -1) {
log_warn("%s: error setting IP_TTL", __func__);
return (-1);
}
@@ -263,7 +263,7 @@ int
sock_set_ipv4_mcast_ttl(int fd, uint8_t ttl)
{
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *)&ttl, sizeof(ttl)) < 0) {
+ (char *)&ttl, sizeof(ttl)) == -1) {
log_warn("%s: error setting IP_MULTICAST_TTL to %d",
__func__, ttl);
return (-1);
@@ -280,7 +280,7 @@ sock_set_ipv4_mcast(struct iface *iface)
addr = if_get_ipv4_addr(iface);
if (setsockopt(global.ipv4.ldp_disc_socket, IPPROTO_IP, IP_MULTICAST_IF,
- &addr, sizeof(addr)) < 0) {
+ &addr, sizeof(addr)) == -1) {
log_warn("%s: error setting IP_MULTICAST_IF, interface %s",
__func__, iface->name);
return (-1);
@@ -295,7 +295,7 @@ sock_set_ipv4_mcast_loop(int fd)
uint8_t loop = 0;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0) {
+ (char *)&loop, sizeof(loop)) == -1) {
log_warn("%s: error setting IP_MULTICAST_LOOP", __func__);
return (-1);
}
@@ -307,7 +307,7 @@ int
sock_set_ipv6_dscp(int fd, int dscp)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &dscp,
- sizeof(dscp)) < 0) {
+ sizeof(dscp)) == -1) {
log_warn("%s: error setting IPV6_TCLASS", __func__);
return (-1);
}
@@ -319,7 +319,7 @@ int
sock_set_ipv6_pktinfo(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("%s: error setting IPV6_RECVPKTINFO", __func__);
return (-1);
}
@@ -331,7 +331,7 @@ int
sock_set_ipv6_minhopcount(int fd, int hoplimit)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MINHOPCOUNT,
- &hoplimit, sizeof(hoplimit)) < 0) {
+ &hoplimit, sizeof(hoplimit)) == -1) {
log_warn("%s: error setting IPV6_MINHOPCOUNT", __func__);
return (-1);
}
@@ -343,7 +343,7 @@ int
sock_set_ipv6_ucast_hops(int fd, int hoplimit)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
- &hoplimit, sizeof(hoplimit)) < 0) {
+ &hoplimit, sizeof(hoplimit)) == -1) {
log_warn("%s: error setting IPV6_UNICAST_HOPS", __func__);
return (-1);
}
@@ -355,7 +355,7 @@ int
sock_set_ipv6_mcast_hops(int fd, int hoplimit)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- &hoplimit, sizeof(hoplimit)) < 0) {
+ &hoplimit, sizeof(hoplimit)) == -1) {
log_warn("%s: error setting IPV6_MULTICAST_HOPS", __func__);
return (-1);
}
@@ -367,7 +367,7 @@ int
sock_set_ipv6_mcast(struct iface *iface)
{
if (setsockopt(global.ipv6.ldp_disc_socket, IPPROTO_IPV6,
- IPV6_MULTICAST_IF, &iface->ifindex, sizeof(iface->ifindex)) < 0) {
+ IPV6_MULTICAST_IF, &iface->ifindex, sizeof(iface->ifindex)) == -1) {
log_warn("%s: error setting IPV6_MULTICAST_IF, interface %s",
__func__, iface->name);
return (-1);
@@ -382,7 +382,7 @@ sock_set_ipv6_mcast_loop(int fd)
unsigned int loop = 0;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- &loop, sizeof(loop)) < 0) {
+ &loop, sizeof(loop)) == -1) {
log_warn("%s: error setting IPV6_MULTICAST_LOOP", __func__);
return (-1);
}
diff --git a/usr.sbin/lpd/lpd.c b/usr.sbin/lpd/lpd.c
index 82a3ddb578d..01b5760cdc6 100644
--- a/usr.sbin/lpd/lpd.c
+++ b/usr.sbin/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.1 2018/04/27 16:14:37 eric Exp $ */
+/* $OpenBSD: lpd.c,v 1.2 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2017 Eric Faurot <eric@openbsd.org>
@@ -313,7 +313,7 @@ priv_open_listener(struct listener *l)
case AF_INET6:
opt = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt,
- sizeof(opt)) < 0)
+ sizeof(opt)) == -1)
fatal("setsockopt: %s", log_fmt_sockaddr(sa));
if (bind(sock, sa, sa->sa_len) == -1)
diff --git a/usr.sbin/lpd/parse.y b/usr.sbin/lpd/parse.y
index 123a294dda0..e22ddb3d9ee 100644
--- a/usr.sbin/lpd/parse.y
+++ b/usr.sbin/lpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.6 2019/02/13 22:57:08 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.7 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -936,7 +936,7 @@ is_if_in_group(const char *ifname, const char *groupname)
int s;
int ret = 0;
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
memset(&ifgr, 0, sizeof(ifgr));
diff --git a/usr.sbin/map-mbone/mapper.c b/usr.sbin/map-mbone/mapper.c
index a1bcbab7cd0..925432b56df 100644
--- a/usr.sbin/map-mbone/mapper.c
+++ b/usr.sbin/map-mbone/mapper.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mapper.c,v 1.24 2016/08/03 23:13:54 krw Exp $ */
+/* $OpenBSD: mapper.c,v 1.25 2019/06/28 13:32:48 deraadt Exp $ */
/* $NetBSD: mapper.c,v 1.3 1995/12/10 11:12:04 mycroft Exp $ */
/* Mapper for connections between MRouteD multicast routers.
@@ -876,9 +876,9 @@ int main(int argc, char *argv[])
addr.sin_len = sizeof addr;
addr.sin_addr.s_addr = dvmrp_group;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
- if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
- || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0
- || getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
+ if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1
+ || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) == -1
+ || getsockname(udp, (struct sockaddr *) &addr, &addrlen) == -1) {
perror("Determining local address");
exit(1);
}
@@ -908,7 +908,7 @@ int main(int argc, char *argv[])
count = poll(pfd, 1, timeout * 1000);
- if (count < 0) {
+ if (count == -1) {
if (errno != EINTR)
perror("select");
continue;
diff --git a/usr.sbin/memconfig/memconfig.c b/usr.sbin/memconfig/memconfig.c
index 628675d4756..601dd1b7d0b 100644
--- a/usr.sbin/memconfig/memconfig.c
+++ b/usr.sbin/memconfig/memconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: memconfig.c,v 1.18 2016/08/14 18:34:48 guenther Exp $ */
+/* $OpenBSD: memconfig.c,v 1.19 2019/06/28 13:32:48 deraadt Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
@@ -132,7 +132,7 @@ mrgetall(int memfd, int *nmr)
struct mem_range_op mro;
mro.mo_arg[0] = 0;
- if (ioctl(memfd, MEMRANGE_GET, &mro))
+ if (ioctl(memfd, MEMRANGE_GET, &mro) == -1)
err(1, "can't size range descriptor array");
*nmr = mro.mo_arg[0];
@@ -143,7 +143,7 @@ mrgetall(int memfd, int *nmr)
mro.mo_arg[0] = *nmr;
mro.mo_desc = mrd;
- if (ioctl(memfd, MEMRANGE_GET, &mro))
+ if (ioctl(memfd, MEMRANGE_GET, &mro) == -1)
err(1, "can't fetch range descriptor array");
return(mrd);
@@ -254,7 +254,7 @@ setfunc(int memfd, int argc, char *argv[])
mro.mo_desc = &mrd;
mro.mo_arg[0] = 0;
- if (ioctl(memfd, MEMRANGE_SET, &mro))
+ if (ioctl(memfd, MEMRANGE_SET, &mro) == -1)
err(1, "can't set range");
}
@@ -307,7 +307,7 @@ clearfunc(int memfd, int argc, char *argv[])
!(mrdp[i].mr_flags & MDF_FIXACTIVE)) {
mro.mo_desc = mrdp + i;
- if (ioctl(memfd, MEMRANGE_SET, &mro))
+ if (ioctl(memfd, MEMRANGE_SET, &mro) == -1)
warn("couldn't clear range owned by '%s'",
owner);
}
@@ -316,7 +316,7 @@ clearfunc(int memfd, int argc, char *argv[])
/* clear-by-base/len */
mro.mo_arg[0] = MEMRANGE_SET_REMOVE;
mro.mo_desc = &mrd;
- if (ioctl(memfd, MEMRANGE_SET, &mro))
+ if (ioctl(memfd, MEMRANGE_SET, &mro) == -1)
err(1, "couldn't clear range");
} else {
help("clear");
diff --git a/usr.sbin/mksuncd/mksuncd.c b/usr.sbin/mksuncd/mksuncd.c
index dc6becb3422..cd1114c0ed9 100644
--- a/usr.sbin/mksuncd/mksuncd.c
+++ b/usr.sbin/mksuncd/mksuncd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mksuncd.c,v 1.3 2015/10/12 07:45:48 deraadt Exp $ */
+/* $OpenBSD: mksuncd.c,v 1.4 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
@@ -282,7 +282,7 @@ adjust_label(int f, struct sun_disklabel *slp, int part, off_t start, off_t size
return (-1);
i = write(f, slp, sizeof(*slp));
- if (i < 0)
+ if (i == -1)
err(1, "write modified label");
if (i != sizeof(*slp))
errx(1, "short write modified label");
@@ -297,13 +297,13 @@ append_osfile(int outf, int inf)
while (1) {
len = read(inf, buf, sizeof(buf));
- if (len < 0)
+ if (len == -1)
err(1, "read osfile");
if (len == 0)
return (0);
r = write(outf, buf, len);
- if (r < 0)
+ if (r == -1)
err(1, "write basefile");
if (r != len)
errx(1, "short write basefile");
diff --git a/usr.sbin/mkuboot/mkuboot.c b/usr.sbin/mkuboot/mkuboot.c
index c7fb31de823..9afc02f654c 100644
--- a/usr.sbin/mkuboot/mkuboot.c
+++ b/usr.sbin/mkuboot/mkuboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkuboot.c,v 1.8 2017/10/29 08:45:53 mpi Exp $ */
+/* $OpenBSD: mkuboot.c,v 1.9 2019/06/28 13:32:48 deraadt Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
@@ -224,13 +224,13 @@ main(int argc, char *argv[])
strlcpy((char *)ih.ih_name, imgname, sizeof ih.ih_name);
ifd = open(iname, O_RDONLY);
- if (ifd < 0)
+ if (ifd == -1)
err(1, "%s", iname);
if (fstat(ifd, &sb) == -1)
err(1, "%s", iname);
ofd = open(oname, O_RDWR | O_TRUNC | O_CREAT, 0644);
- if (ofd < 0)
+ if (ofd == -1)
err(1, "%s", oname);
if (pledge("stdio", NULL) == -1)
diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c
index c1f70d9723d..47c51854153 100644
--- a/usr.sbin/mrinfo/mrinfo.c
+++ b/usr.sbin/mrinfo/mrinfo.c
@@ -375,9 +375,9 @@ main(int argc, char *argv[])
addr.sin_addr.s_addr = target_addr;
addr.sin_port = htons(2000); /* any port over 1024 will
* do... */
- if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ||
- connect(udp, (struct sockaddr *) & addr, sizeof(addr)) < 0 ||
- getsockname(udp, (struct sockaddr *) & addr, &addrlen) < 0) {
+ if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1 ||
+ connect(udp, (struct sockaddr *) & addr, sizeof(addr)) == -1 ||
+ getsockname(udp, (struct sockaddr *) & addr, &addrlen) == -1) {
perror("Determining local address");
exit(1);
}
@@ -422,7 +422,7 @@ main(int argc, char *argv[])
count = poll(pfd, 1, tv.tv_sec * 1000);
- if (count < 0) {
+ if (count == -1) {
if (errno != EINTR)
perror("select");
continue;
diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y
index 9269812d323..0b8af93ea21 100644
--- a/usr.sbin/mrouted/cfparse.y
+++ b/usr.sbin/mrouted/cfparse.y
@@ -142,7 +142,7 @@ stmt : error
inet_fmt($2, s1));
strlcpy(ffr.ifr_name, ifname, sizeof(ffr.ifr_name));
- if (ioctl(udp_socket, SIOCGIFFLAGS, (char *)&ffr)<0)
+ if (ioctl(udp_socket, SIOCGIFFLAGS, (char *)&ffr) == -1)
fatal("ioctl SIOCGIFFLAGS on %s",ffr.ifr_name);
if (ffr.ifr_flags & IFF_LOOPBACK)
fatal("Tunnel local address %s is a loopback interface",
diff --git a/usr.sbin/mrouted/config.c b/usr.sbin/mrouted/config.c
index 20f193fd761..9ba913f577f 100644
--- a/usr.sbin/mrouted/config.c
+++ b/usr.sbin/mrouted/config.c
@@ -27,7 +27,7 @@ config_vifs_from_kernel(void)
u_int32_t addr, mask, subnet;
short flags;
- if (getifaddrs(&ifap) < 0)
+ if (getifaddrs(&ifap) == -1)
logit(LOG_ERR, errno, "getifaddrs");
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
diff --git a/usr.sbin/mrouted/igmp.c b/usr.sbin/mrouted/igmp.c
index 46a652e6c5f..a6e5a55f299 100644
--- a/usr.sbin/mrouted/igmp.c
+++ b/usr.sbin/mrouted/igmp.c
@@ -43,7 +43,7 @@ init_igmp(void)
recv_buf = malloc(RECV_BUF_SIZE);
send_buf = malloc(RECV_BUF_SIZE);
- if ((igmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP)) < 0)
+ if ((igmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP)) == -1)
logit(LOG_ERR, errno, "IGMP socket");
k_hdr_include(TRUE); /* include IP header when sending */
@@ -331,7 +331,7 @@ send_igmp(u_int32_t src, u_int32_t dst, int type, int code,
sdst.sin_len = sizeof(sdst);
sdst.sin_addr.s_addr = dst;
if (sendto(igmp_socket, send_buf, ntohs(ip->ip_len), 0,
- (struct sockaddr *)&sdst, sizeof(sdst)) < 0) {
+ (struct sockaddr *)&sdst, sizeof(sdst)) == -1) {
if (errno == ENETDOWN)
check_vif_state();
else
diff --git a/usr.sbin/mrouted/kern.c b/usr.sbin/mrouted/kern.c
index 89171d2b19b..2c0154d3276 100644
--- a/usr.sbin/mrouted/kern.c
+++ b/usr.sbin/mrouted/kern.c
@@ -16,7 +16,7 @@
void k_set_rcvbuf(int bufsize)
{
if (setsockopt(igmp_socket, SOL_SOCKET, SO_RCVBUF,
- (char *)&bufsize, sizeof(bufsize)) < 0)
+ (char *)&bufsize, sizeof(bufsize)) == -1)
logit(LOG_ERR, errno, "setsockopt SO_RCVBUF %u", bufsize);
}
@@ -25,7 +25,7 @@ void k_hdr_include(int bool)
{
#ifdef IP_HDRINCL
if (setsockopt(igmp_socket, IPPROTO_IP, IP_HDRINCL,
- (char *)&bool, sizeof(bool)) < 0)
+ (char *)&bool, sizeof(bool)) == -1)
logit(LOG_ERR, errno, "setsockopt IP_HDRINCL %u", bool);
#endif
}
@@ -37,7 +37,7 @@ void k_set_ttl(int t)
ttl = t;
if (setsockopt(igmp_socket, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *)&ttl, sizeof(ttl)) < 0)
+ (char *)&ttl, sizeof(ttl)) == -1)
logit(LOG_ERR, errno, "setsockopt IP_MULTICAST_TTL %u", ttl);
}
@@ -48,7 +48,7 @@ void k_set_loop(int l)
loop = l;
if (setsockopt(igmp_socket, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0)
+ (char *)&loop, sizeof(loop)) == -1)
logit(LOG_ERR, errno, "setsockopt IP_MULTICAST_LOOP %u", loop);
}
@@ -59,7 +59,7 @@ void k_set_if(u_int32_t ifa)
adr.s_addr = ifa;
if (setsockopt(igmp_socket, IPPROTO_IP, IP_MULTICAST_IF,
- (char *)&adr, sizeof(adr)) < 0)
+ (char *)&adr, sizeof(adr)) == -1)
logit(LOG_ERR, errno, "setsockopt IP_MULTICAST_IF %s",
inet_fmt(ifa, s1));
}
@@ -73,7 +73,7 @@ void k_join(u_int32_t grp, u_int32_t ifa)
mreq.imr_interface.s_addr = ifa;
if (setsockopt(igmp_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (char *)&mreq, sizeof(mreq)) < 0)
+ (char *)&mreq, sizeof(mreq)) == -1)
logit(LOG_WARNING, errno, "can't join group %s on interface %s",
inet_fmt(grp, s1), inet_fmt(ifa, s2));
}
@@ -87,7 +87,7 @@ void k_leave(u_int32_t grp, u_int32_t ifa)
mreq.imr_interface.s_addr = ifa;
if (setsockopt(igmp_socket, IPPROTO_IP, IP_DROP_MEMBERSHIP,
- (char *)&mreq, sizeof(mreq)) < 0)
+ (char *)&mreq, sizeof(mreq)) == -1)
logit(LOG_WARNING, errno, "can't leave group %s on interface %s",
inet_fmt(grp, s1), inet_fmt(ifa, s2));
}
@@ -97,12 +97,12 @@ void k_init_dvmrp(void)
{
#ifdef OLD_KERNEL
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_INIT,
- (char *)NULL, 0) < 0)
+ (char *)NULL, 0) == -1)
#else
int v=1;
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_INIT,
- (char *)&v, sizeof(int)) < 0)
+ (char *)&v, sizeof(int)) == -1)
#endif
logit(LOG_ERR, errno, "can't enable Multicast routing in kernel");
}
@@ -111,7 +111,7 @@ void k_init_dvmrp(void)
void k_stop_dvmrp(void)
{
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_DONE,
- (char *)NULL, 0) < 0)
+ (char *)NULL, 0) == -1)
logit(LOG_WARNING, errno, "can't disable Multicast routing in kernel");
}
@@ -128,7 +128,7 @@ void k_add_vif(vifi_t vifi, struct uvif *v)
vc.vifc_rmt_addr.s_addr = v->uv_rmt_addr;
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_ADD_VIF,
- (char *)&vc, sizeof(vc)) < 0)
+ (char *)&vc, sizeof(vc)) == -1)
logit(LOG_ERR, errno, "setsockopt MRT_ADD_VIF");
}
@@ -136,7 +136,7 @@ void k_add_vif(vifi_t vifi, struct uvif *v)
void k_del_vif(vifi_t vifi)
{
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_DEL_VIF,
- (char *)&vifi, sizeof(vifi)) < 0)
+ (char *)&vifi, sizeof(vifi)) == -1)
logit(LOG_ERR, errno, "setsockopt MRT_DEL_VIF");
}
@@ -164,7 +164,7 @@ void k_add_rg(u_int32_t origin, struct gtable *g)
/* write to kernel space */
if (setsockopt(igmp_socket, IPPROTO_IP, MRT_ADD_MFC,
- (char *)&mc, sizeof(mc)) < 0) {
+ (char *)&mc, sizeof(mc)) == -1) {
#ifdef DEBUG_MFC
md_logit(MD_ADD_FAIL, origin, g->gt_mcastgrp);
#endif
@@ -193,7 +193,7 @@ int k_del_rg(u_int32_t origin, struct gtable *g)
/* write to kernel space */
if ((retval = setsockopt(igmp_socket, IPPROTO_IP, MRT_DEL_MFC,
- (char *)&mc, sizeof(mc))) < 0) {
+ (char *)&mc, sizeof(mc))) == -1) {
#ifdef DEBUG_MFC
md_logit(MD_DEL_FAIL, origin, g->gt_mcastgrp);
#endif
@@ -215,7 +215,7 @@ int k_get_version(void)
int len = sizeof(vers);
if (getsockopt(igmp_socket, IPPROTO_IP, MRT_VERSION,
- (char *)&vers, &len) < 0)
+ (char *)&vers, &len) == -1)
logit(LOG_ERR, errno,
"getsockopt MRT_VERSION: perhaps your kernel is too old");
diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c
index 2d3334b3ac8..4c83bc95e93 100644
--- a/usr.sbin/mrouted/main.c
+++ b/usr.sbin/mrouted/main.c
@@ -142,7 +142,7 @@ usage: fprintf(stderr,
(void)close(t);
}
#else
- if (setsid() < 0)
+ if (setsid() == -1)
perror("setsid");
#endif
}
@@ -250,7 +250,7 @@ usage: fprintf(stderr,
*/
dummy = 0;
for(;;) {
- if ((n = poll(pfd, nhandlers + 1, -1)) < 0) {
+ if ((n = poll(pfd, nhandlers + 1, -1)) == -1) {
if (errno != EINTR) /* SIGALRM is expected */
logit(LOG_WARNING, errno, "poll failed");
continue;
@@ -259,13 +259,13 @@ usage: fprintf(stderr,
if (pfd[0].revents & POLLIN) {
recvlen = recvfrom(igmp_socket, recv_buf, RECV_BUF_SIZE,
0, NULL, &dummy);
- if (recvlen < 0) {
+ if (recvlen == -1) {
if (errno != EINTR) logit(LOG_ERR, errno, "recvfrom");
continue;
}
(void)sigemptyset(&mask);
(void)sigaddset(&mask, SIGALRM);
- if (sigprocmask(SIG_BLOCK, &mask, &omask) < 0)
+ if (sigprocmask(SIG_BLOCK, &mask, &omask) == -1)
logit(LOG_ERR, errno, "sigprocmask");
accept_igmp(recvlen);
(void)sigprocmask(SIG_SETMASK, &omask, NULL);
@@ -488,7 +488,7 @@ restart(int i)
*/
(void)sigemptyset(&mask);
(void)sigaddset(&mask, SIGALRM);
- if (sigprocmask(SIG_BLOCK, &mask, &omask) < 0)
+ if (sigprocmask(SIG_BLOCK, &mask, &omask) == -1)
logit(LOG_ERR, errno, "sigprocmask");
free_all_prunes();
free_all_routes();
diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c
index e51d3de6ce8..8bc1f7c397c 100644
--- a/usr.sbin/mrouted/prune.c
+++ b/usr.sbin/mrouted/prune.c
@@ -1469,7 +1469,7 @@ age_table_entry(void)
stnp = &gt->gt_srctbl;
while ((st = *stnp) != NULL) {
sg_req.src.s_addr = st->st_origin;
- if (ioctl(udp_socket, SIOCGETSGCNT, (char *)&sg_req) < 0) {
+ if (ioctl(udp_socket, SIOCGETSGCNT, (char *)&sg_req) == -1) {
logit(LOG_WARNING, errno, "%s (%s %s)",
"age_table_entry: SIOCGETSGCNT failing for",
inet_fmt(st->st_origin, s1),
@@ -1901,7 +1901,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group,
* obtain # of packets out on interface
*/
v_req.vifi = vifi;
- if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) >= 0)
+ if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) == 0)
resp->tr_vifout = htonl(v_req.ocount);
/*
@@ -1918,7 +1918,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group,
if (gt && gt->gt_mcastgrp == group) {
sg_req.src.s_addr = qry->tr_src;
sg_req.grp.s_addr = group;
- if (ioctl(udp_socket, SIOCGETSGCNT, (char *)&sg_req) >= 0)
+ if (ioctl(udp_socket, SIOCGETSGCNT, (char *)&sg_req) == 0)
resp->tr_pktcnt = htonl(sg_req.pktcnt);
if (VIFM_ISSET(vifi, gt->gt_scope))
@@ -1950,7 +1950,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group,
} else {
/* get # of packets in on interface */
v_req.vifi = rt->rt_parent;
- if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) >= 0)
+ if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) == 0)
resp->tr_vifin = htonl(v_req.icount);
MASK_TO_VAL(rt->rt_originmask, resp->tr_smask);
diff --git a/usr.sbin/mrouted/rsrr.c b/usr.sbin/mrouted/rsrr.c
index 4bf8183ff8a..3cf659de420 100644
--- a/usr.sbin/mrouted/rsrr.c
+++ b/usr.sbin/mrouted/rsrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsrr.c,v 1.15 2017/01/21 11:32:04 guenther Exp $ */
+/* $OpenBSD: rsrr.c,v 1.16 2019/06/28 13:32:48 deraadt Exp $ */
/* $NetBSD: rsrr.c,v 1.3 1995/12/10 10:07:14 mycroft Exp $ */
/*
@@ -85,7 +85,7 @@ rsrr_init(void)
{
struct sockaddr_un serv_addr;
- if ((rsrr_socket = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
+ if ((rsrr_socket = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
logit(LOG_ERR, errno, "Can't create RSRR socket");
unlink(RSRR_SERV_PATH);
@@ -93,7 +93,7 @@ rsrr_init(void)
serv_addr.sun_family = AF_UNIX;
strlcpy(serv_addr.sun_path, RSRR_SERV_PATH, sizeof serv_addr.sun_path);
- if (bind(rsrr_socket, (struct sockaddr *)&serv_addr, sizeof serv_addr) < 0)
+ if (bind(rsrr_socket, (struct sockaddr *)&serv_addr, sizeof serv_addr) == -1)
logit(LOG_ERR, errno, "Can't bind RSRR socket");
if (register_input_handler(rsrr_socket,rsrr_read) < 0)
@@ -110,7 +110,7 @@ rsrr_read(int f)
bzero((char *) &client_addr, sizeof(client_addr));
rsrr_recvlen = recvfrom(rsrr_socket, rsrr_recv_buf, sizeof(rsrr_recv_buf),
0, (struct sockaddr *)&client_addr, &client_length);
- if (rsrr_recvlen < 0) {
+ if (rsrr_recvlen == -1) {
if (errno != EINTR)
logit(LOG_ERR, errno, "RSRR recvfrom");
return;
@@ -370,7 +370,7 @@ rsrr_send(int sendlen)
(struct sockaddr *)&client_addr, client_length);
/* Check for errors. */
- if (error < 0) {
+ if (error == -1) {
logit(LOG_WARNING, errno, "Failed send on RSRR socket");
} else if (error != sendlen) {
logit(LOG_WARNING, 0,
diff --git a/usr.sbin/mrouted/vif.c b/usr.sbin/mrouted/vif.c
index be1baf52299..c228a88c494 100644
--- a/usr.sbin/mrouted/vif.c
+++ b/usr.sbin/mrouted/vif.c
@@ -71,7 +71,7 @@ init_vifs(void)
* the kernel and the contents of the configuration file.
* (Open a UDP socket for ioctl use in the config procedures.)
*/
- if ((udp_socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((udp_socket = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
logit(LOG_ERR, errno, "UDP socket");
logit(LOG_INFO,0,"Getting vifs from kernel interfaces");
config_vifs_from_kernel();
@@ -169,7 +169,7 @@ check_vif_state(void)
if (v->uv_flags & VIFF_DISABLED) continue;
strncpy(ifr.ifr_name, v->uv_name, IFNAMSIZ);
- if (ioctl(udp_socket, SIOCGIFFLAGS, (char *)&ifr) < 0)
+ if (ioctl(udp_socket, SIOCGIFFLAGS, (char *)&ifr) == -1)
logit(LOG_ERR, errno,
"ioctl SIOCGIFFLAGS for %s", ifr.ifr_name);
@@ -702,9 +702,9 @@ accept_neighbor_request(u_int32_t src, u_int32_t dst)
addr.sin_len = sizeof addr;
addr.sin_addr.s_addr = dst;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
- if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
- || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0
- || getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
+ if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1
+ || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) == -1
+ || getsockname(udp, (struct sockaddr *) &addr, &addrlen) == -1) {
logit(LOG_WARNING, errno, "Determining local address");
close(udp);
return;
@@ -787,9 +787,9 @@ accept_neighbor_request2(u_int32_t src, u_int32_t dst)
addr.sin_len = sizeof addr;
addr.sin_addr.s_addr = dst;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
- if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
- || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0
- || getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
+ if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1
+ || connect(udp, (struct sockaddr *) &addr, sizeof(addr)) == -1
+ || getsockname(udp, (struct sockaddr *) &addr, &addrlen) == -1) {
logit(LOG_WARNING, errno, "Determining local address");
close(udp);
return;
@@ -1332,7 +1332,7 @@ dump_vifs(FILE *fp)
}
}
v_req.vifi = vifi;
- if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) < 0) {
+ if (ioctl(udp_socket, SIOCGETVIFCNT, (char *)&v_req) == -1) {
logit(LOG_WARNING, 0,
"SIOCGETVIFCNT fails");
}
diff --git a/usr.sbin/mtrace/mtrace.c b/usr.sbin/mtrace/mtrace.c
index 8b5e657fa0d..5acf9ab3171 100644
--- a/usr.sbin/mtrace/mtrace.c
+++ b/usr.sbin/mtrace/mtrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrace.c,v 1.39 2017/08/31 12:03:02 otto Exp $ */
+/* $OpenBSD: mtrace.c,v 1.40 2019/06/28 13:32:49 deraadt Exp $ */
/* $NetBSD: mtrace.c,v 1.5 1995/12/10 10:57:15 mycroft Exp $ */
/*
@@ -443,7 +443,7 @@ send_recv(u_int32_t dst, int type, int code, int tries, struct resp_buf *save)
count = poll(pfd, 1, tv.tv_sec * 1000);
- if (count < 0) {
+ if (count == -1) {
if (errno != EINTR) perror("poll");
continue;
} else if (count == 0) {
@@ -1280,9 +1280,9 @@ usage: mtrace [-lMnpsv] [-g gateway] [-i if_addr] [-m max_hops] [-q nqueries]\n\
addr.sin_addr.s_addr = qgrp;
addr.sin_port = htons(2000); /* Any port above 1024 will do */
- if (((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ||
- (connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0) ||
- getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
+ if (((udp = socket(AF_INET, SOCK_DGRAM, 0)) == -1) ||
+ (connect(udp, (struct sockaddr *) &addr, sizeof(addr)) == -1) ||
+ getsockname(udp, (struct sockaddr *) &addr, &addrlen) == -1) {
perror("Determining local address");
exit(1);
}
diff --git a/usr.sbin/mtree/compare.c b/usr.sbin/mtree/compare.c
index 0582e75c39c..e759d9f09b5 100644
--- a/usr.sbin/mtree/compare.c
+++ b/usr.sbin/mtree/compare.c
@@ -1,5 +1,5 @@
/* $NetBSD: compare.c,v 1.11 1996/09/05 09:56:48 mycroft Exp $ */
-/* $OpenBSD: compare.c,v 1.27 2016/08/16 16:41:46 krw Exp $ */
+/* $OpenBSD: compare.c,v 1.28 2019/06/28 13:32:49 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -220,7 +220,7 @@ typeerr: LABEL;
}
}
if (s->flags & F_CKSUM) {
- if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) < 0) {
+ if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) == -1) {
LABEL;
(void)printf("%scksum: %s: %s\n",
tab, p->fts_accpath, strerror(errno));
diff --git a/usr.sbin/mtree/crc.c b/usr.sbin/mtree/crc.c
index c33b8ac061b..7098c0a7e50 100644
--- a/usr.sbin/mtree/crc.c
+++ b/usr.sbin/mtree/crc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crc.c,v 1.3 2009/10/27 23:59:53 deraadt Exp $ */
+/* $OpenBSD: crc.c,v 1.4 2019/06/28 13:32:49 deraadt Exp $ */
/* $NetBSD: crc.c,v 1.7 1996/02/27 21:29:53 jtc Exp $ */
/*-
@@ -118,7 +118,7 @@ crc(int fd, u_int32_t *cval, u_int32_t *clen)
COMPUTE(crc, *p);
COMPUTE(crc_total, *p);
}
- if (nr < 0)
+ if (nr == -1)
return (1);
*clen = len;
diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c
index 45feab40277..bcab0023ead 100644
--- a/usr.sbin/mtree/create.c
+++ b/usr.sbin/mtree/create.c
@@ -1,5 +1,5 @@
/* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */
-/* $OpenBSD: create.c,v 1.33 2018/09/16 02:41:16 millert Exp $ */
+/* $OpenBSD: create.c,v 1.34 2019/06/28 13:32:49 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -192,7 +192,7 @@ statf(int indent, FTSENT *p)
(long long)p->fts_statp->st_mtimespec.tv_sec,
p->fts_statp->st_mtimespec.tv_nsec);
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
- if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) < 0 ||
+ if ((fd = open(p->fts_accpath, MTREE_O_FLAGS, 0)) == -1 ||
crc(fd, &val, &len))
error("%s: %s", p->fts_accpath, strerror(errno));
(void)close(fd);
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
index 2791d8b0375..099cb155c74 100644
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ndp.c,v 1.92 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: ndp.c,v 1.93 2019/06/28 13:32:49 deraadt Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
@@ -289,9 +289,9 @@ getsocket(void)
if (rtsock >= 0)
return;
rtsock = socket(AF_ROUTE, SOCK_RAW, 0);
- if (rtsock < 0)
+ if (rtsock == -1)
err(1, "routing socket");
- if (setsockopt(rtsock, AF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) < 0)
+ if (setsockopt(rtsock, AF_ROUTE, ROUTE_TABLEFILTER, &rdomain, len) == -1)
err(1, "ROUTE_TABLEFILTER");
if (pledge("stdio dns", NULL) == -1)
@@ -700,13 +700,13 @@ getnbrinfo(struct in6_addr *addr, int ifindex, int warning)
static struct in6_nbrinfo nbi;
int s;
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
bzero(&nbi, sizeof(nbi));
if_indextoname(ifindex, nbi.ifname);
nbi.addr = *addr;
- if (ioctl(s, SIOCGNBRINFO_IN6, (caddr_t)&nbi) < 0) {
+ if (ioctl(s, SIOCGNBRINFO_IN6, (caddr_t)&nbi) == -1) {
if (warning)
warn("ioctl(SIOCGNBRINFO_IN6)");
close(s);
@@ -814,7 +814,7 @@ doit:
l = rtm->rtm_msglen;
rtm->rtm_seq = ++seq;
rtm->rtm_type = cmd;
- if ((rlen = write(rtsock, (char *)&m_rtmsg, l)) < 0) {
+ if ((rlen = write(rtsock, (char *)&m_rtmsg, l)) == -1) {
if (errno != ESRCH || cmd != RTM_DELETE) {
err(1, "writing to routing socket");
/* NOTREACHED */
@@ -824,7 +824,7 @@ doit:
l = read(rtsock, (char *)&m_rtmsg, sizeof(m_rtmsg));
} while (l > 0 && (rtm->rtm_version != RTM_VERSION ||
rtm->rtm_seq != seq || rtm->rtm_pid != pid));
- if (l < 0)
+ if (l == -1)
(void) fprintf(stderr, "ndp: read from routing socket: %s\n",
strerror(errno));
return (0);
@@ -878,13 +878,13 @@ ifinfo(char *ifname)
struct in6_ndireq nd;
int s;
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) {
err(1, "socket");
/* NOTREACHED */
}
bzero(&nd, sizeof(nd));
strlcpy(nd.ifname, ifname, sizeof(nd.ifname));
- if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0)
+ if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) == -1)
err(1, "ioctl(SIOCGIFINFO_IN6)");
if (!nd.ndi.initialized)
diff --git a/usr.sbin/npppctl/npppctl.c b/usr.sbin/npppctl/npppctl.c
index 45c2a50185d..82706168073 100644
--- a/usr.sbin/npppctl/npppctl.c
+++ b/usr.sbin/npppctl/npppctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: npppctl.c,v 1.8 2017/08/11 16:25:59 goda Exp $ */
+/* $OpenBSD: npppctl.c,v 1.9 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2012 Internet Initiative Japan Inc.
@@ -102,12 +102,12 @@ main(int argc, char *argv[])
if ((result = parse(argc, argv)) == NULL)
exit(EXIT_FAILURE);
- if ((ctlsock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+ if ((ctlsock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
err(EXIT_FAILURE, "socket");
memset(&sun, 0, sizeof(sun));
sun.sun_family = AF_UNIX;
strlcpy(sun.sun_path, npppd_ctlpath, sizeof(sun.sun_path));
- if (connect(ctlsock, (struct sockaddr *)&sun, sizeof(sun)) < 0)
+ if (connect(ctlsock, (struct sockaddr *)&sun, sizeof(sun)) == -1)
err(EXIT_FAILURE, "connect");
imsg_init(&ctl_ibuf, ctlsock);
diff --git a/usr.sbin/ntpd/constraint.c b/usr.sbin/ntpd/constraint.c
index f1af7fa602a..f478ec789e9 100644
--- a/usr.sbin/ntpd/constraint.c
+++ b/usr.sbin/ntpd/constraint.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: constraint.c,v 1.46 2019/06/16 07:36:25 otto Exp $ */
+/* $OpenBSD: constraint.c,v 1.47 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -955,7 +955,7 @@ httpsdate_request(struct httpsdate *httpsdate, struct timeval *when)
ret = tls_write(httpsdate->tls_ctx, buf, len);
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT)
continue;
- if (ret < 0) {
+ if (ret == -1) {
log_warnx("tls write failed: %s (%s): %s",
httpsdate->tls_addr, httpsdate->tls_hostname,
tls_error(httpsdate->tls_ctx));
@@ -1091,7 +1091,7 @@ tls_readline(struct tls *tls, size_t *lenp, size_t *maxlength,
ret = tls_read(tls, &c, 1);
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT)
goto again;
- if (ret < 0) {
+ if (ret == -1) {
/* SSL read error, ignore */
free(buf);
return (NULL);
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 33037db8464..ef1b43e133a 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.123 2019/06/27 15:18:42 otto Exp $ */
+/* $OpenBSD: ntpd.c,v 1.124 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -111,7 +111,7 @@ auto_preconditions(const struct ntpd_conf *cnf)
int constraints, securelevel;
size_t sz = sizeof(int);
- if (sysctl(mib, 2, &securelevel, &sz, NULL, 0) < 0)
+ if (sysctl(mib, 2, &securelevel, &sz, NULL, 0) == -1)
err(1, "sysctl");
constraints = !TAILQ_EMPTY(&cnf->constraints);
return !cnf->settime && constraints && securelevel == 0;
diff --git a/usr.sbin/ocspcheck/http.c b/usr.sbin/ocspcheck/http.c
index 5c914a48571..e0df6cfa118 100644
--- a/usr.sbin/ocspcheck/http.c
+++ b/usr.sbin/ocspcheck/http.c
@@ -1,4 +1,4 @@
-/* $Id: http.c,v 1.11 2018/11/29 14:25:07 tedu Exp $ */
+/* $Id: http.c,v 1.12 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -72,7 +72,7 @@ dosysread(char *buf, size_t sz, const struct http *http)
ssize_t rc;
rc = read(http->fd, buf, sz);
- if (rc < 0)
+ if (rc == -1)
warn("%s: read", http->src.ip);
return rc;
}
@@ -83,7 +83,7 @@ dosyswrite(const void *buf, size_t sz, const struct http *http)
ssize_t rc;
rc = write(http->fd, buf, sz);
- if (rc < 0)
+ if (rc == -1)
warn("%s: write", http->src.ip);
return rc;
}
@@ -97,7 +97,7 @@ dotlsread(char *buf, size_t sz, const struct http *http)
rc = tls_read(http->ctx, buf, sz);
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
- if (rc < 0)
+ if (rc == -1)
warnx("%s: tls_read: %s", http->src.ip,
tls_error(http->ctx));
return rc;
@@ -112,7 +112,7 @@ dotlswrite(const void *buf, size_t sz, const struct http *http)
rc = tls_write(http->ctx, buf, sz);
} while (rc == TLS_WANT_POLLIN || rc == TLS_WANT_POLLOUT);
- if (rc < 0)
+ if (rc == -1)
warnx("%s: tls_write: %s", http->src.ip,
tls_error(http->ctx));
return rc;
diff --git a/usr.sbin/ospf6d/interface.c b/usr.sbin/ospf6d/interface.c
index d97a1149347..9feb8c69e96 100644
--- a/usr.sbin/ospf6d/interface.c
+++ b/usr.sbin/ospf6d/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.24 2018/07/12 13:45:03 remi Exp $ */
+/* $OpenBSD: interface.c,v 1.25 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -735,7 +735,7 @@ if_join_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_JOIN_GROUP,
- &mreq, sizeof(mreq)) < 0) {
+ &mreq, sizeof(mreq)) == -1) {
log_warn("if_join_group: error IPV6_JOIN_GROUP, "
"interface %s address %s", iface->name,
log_in6addr(addr));
@@ -769,7 +769,7 @@ if_leave_group(struct iface *iface, struct in6_addr *addr)
mreq.ipv6mr_interface = iface->ifindex;
if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("if_leave_group: error IPV6_LEAVE_GROUP, "
"interface %s address %s", iface->name,
log_in6addr(addr));
@@ -795,7 +795,7 @@ if_set_mcast(struct iface *iface)
case IF_TYPE_POINTOPOINT:
case IF_TYPE_BROADCAST:
if (setsockopt(iface->fd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
- &iface->ifindex, sizeof(iface->ifindex)) < 0) {
+ &iface->ifindex, sizeof(iface->ifindex)) == -1) {
log_debug("if_set_mcast: error setting "
"IP_MULTICAST_IF, interface %s", iface->name);
return (-1);
@@ -820,7 +820,7 @@ if_set_mcast_loop(int fd)
u_int loop = 0;
if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- (u_int *)&loop, sizeof(loop)) < 0) {
+ (u_int *)&loop, sizeof(loop)) == -1) {
log_warn("if_set_mcast_loop: error setting "
"IPV6_MULTICAST_LOOP");
return (-1);
@@ -833,7 +833,7 @@ int
if_set_ipv6_pktinfo(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("if_set_ipv6_pktinfo: error setting IPV6_PKTINFO");
return (-1);
}
@@ -848,7 +848,7 @@ if_set_ipv6_checksum(int fd)
log_debug("if_set_ipv6_checksum setting cksum offset to %d", offset);
if (setsockopt(fd, IPPROTO_IPV6, IPV6_CHECKSUM, &offset,
- sizeof(offset)) < 0) {
+ sizeof(offset)) == -1) {
log_warn("if_set_ipv6_checksum: error setting IPV6_CHECKSUM");
return (-1);
}
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 57a9ce2f01d..1d966f34b59 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.82 2018/03/11 13:16:49 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.83 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -663,7 +663,7 @@ int
if_set_recvif(int fd, int enable)
{
if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &enable,
- sizeof(enable)) < 0) {
+ sizeof(enable)) == -1) {
log_warn("if_set_recvif: error setting IP_RECVIF");
return (-1);
}
@@ -734,7 +734,7 @@ if_join_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("if_join_group: error IP_ADD_MEMBERSHIP, "
"interface %s address %s", iface->name,
inet_ntoa(*addr));
@@ -782,7 +782,7 @@ if_leave_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0) {
+ (void *)&mreq, sizeof(mreq)) == -1) {
log_warn("if_leave_group: error IP_DROP_MEMBERSHIP, "
"interface %s address %s", iface->name,
inet_ntoa(*addr));
@@ -809,7 +809,7 @@ if_set_mcast(struct iface *iface)
case IF_TYPE_POINTOPOINT:
case IF_TYPE_BROADCAST:
if (setsockopt(iface->fd, IPPROTO_IP, IP_MULTICAST_IF,
- &iface->addr.s_addr, sizeof(iface->addr.s_addr)) < 0) {
+ &iface->addr.s_addr, sizeof(iface->addr.s_addr)) == -1) {
log_warn("if_set_mcast: error setting "
"IP_MULTICAST_IF, interface %s", iface->name);
return (-1);
@@ -834,7 +834,7 @@ if_set_mcast_loop(int fd)
u_int8_t loop = 0;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0) {
+ (char *)&loop, sizeof(loop)) == -1) {
log_warn("if_set_mcast_loop: error setting IP_MULTICAST_LOOP");
return (-1);
}
@@ -847,7 +847,7 @@ if_set_ip_hdrincl(int fd)
{
int hincl = 1;
- if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) < 0) {
+ if (setsockopt(fd, IPPROTO_IP, IP_HDRINCL, &hincl, sizeof(hincl)) == -1) {
log_warn("if_set_ip_hdrincl: error setting IP_HDRINCL");
return (-1);
}
diff --git a/usr.sbin/pcidump/pcidump.c b/usr.sbin/pcidump/pcidump.c
index 7f4a47fabf7..6f159bb9d6a 100644
--- a/usr.sbin/pcidump/pcidump.c
+++ b/usr.sbin/pcidump/pcidump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcidump.c,v 1.54 2019/06/02 02:37:12 dlg Exp $ */
+/* $OpenBSD: pcidump.c,v 1.55 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
@@ -903,14 +903,14 @@ dump_rom(int bus, int dev, int func)
rom.pr_sel.pc_bus = bus;
rom.pr_sel.pc_dev = dev;
rom.pr_sel.pc_func = func;
- if (ioctl(pcifd, PCIOCGETROMLEN, &rom))
+ if (ioctl(pcifd, PCIOCGETROMLEN, &rom) == -1)
return (errno);
rom.pr_rom = malloc(rom.pr_romlen);
if (rom.pr_rom == NULL)
return (ENOMEM);
- if (ioctl(pcifd, PCIOCGETROM, &rom))
+ if (ioctl(pcifd, PCIOCGETROM, &rom) == -1)
return (errno);
if (write(romfd, rom.pr_rom, rom.pr_romlen) == -1)
diff --git a/usr.sbin/portmap/portmap.c b/usr.sbin/portmap/portmap.c
index e7eea45b43f..f8791d4e097 100644
--- a/usr.sbin/portmap/portmap.c
+++ b/usr.sbin/portmap/portmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: portmap.c,v 1.49 2018/08/04 03:23:08 deraadt Exp $ */
+/* $OpenBSD: portmap.c,v 1.50 2019/06/28 13:32:49 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 Theo de Raadt (OpenBSD). All rights reserved.
@@ -138,12 +138,12 @@ main(int argc, char *argv[])
laddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
laddr.sin_port = htons(PMAPPORT);
- if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+ if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
syslog(LOG_ERR, "cannot create udp socket: %m");
exit(1);
}
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);
- if (bind(sock, (struct sockaddr *)&addr, len) != 0) {
+ if (bind(sock, (struct sockaddr *)&addr, len) == -1) {
syslog(LOG_ERR, "cannot bind udp: %m");
exit(1);
}
@@ -153,12 +153,12 @@ main(int argc, char *argv[])
exit(1);
}
- if ((lsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+ if ((lsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
syslog(LOG_ERR, "cannot create udp socket: %m");
exit(1);
}
setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);
- if (bind(lsock, (struct sockaddr *)&laddr, len) != 0) {
+ if (bind(lsock, (struct sockaddr *)&laddr, len) == -1) {
syslog(LOG_ERR, "cannot bind local udp: %m");
exit(1);
}
@@ -181,12 +181,12 @@ main(int argc, char *argv[])
pml->pml_map.pm_port = PMAPPORT;
pmaplist = pml;
- if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
syslog(LOG_ERR, "cannot create tcp socket: %m");
exit(1);
}
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);
- if (bind(sock, (struct sockaddr *)&addr, len) != 0) {
+ if (bind(sock, (struct sockaddr *)&addr, len) == -1) {
syslog(LOG_ERR, "cannot bind tcp: %m");
exit(1);
}
@@ -196,12 +196,12 @@ main(int argc, char *argv[])
exit(1);
}
- if ((lsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ if ((lsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
syslog(LOG_ERR, "cannot create tcp socket: %m");
exit(1);
}
setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);
- if (bind(lsock, (struct sockaddr *)&laddr, len) != 0) {
+ if (bind(lsock, (struct sockaddr *)&laddr, len) == -1) {
syslog(LOG_ERR, "cannot bind tcp: %m");
exit(1);
}
diff --git a/usr.sbin/pppd/sys-bsd.c b/usr.sbin/pppd/sys-bsd.c
index 69ca841d213..e8deee6d2ff 100644
--- a/usr.sbin/pppd/sys-bsd.c
+++ b/usr.sbin/pppd/sys-bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys-bsd.c,v 1.28 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: sys-bsd.c,v 1.29 2019/06/28 13:32:49 deraadt Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -161,7 +161,7 @@ void
sys_init()
{
/* Get an internet socket for doing socket ioctl's on. */
- if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
syslog(LOG_ERR, "Couldn't create IP socket: %m");
die(1);
}
@@ -179,7 +179,7 @@ sys_cleanup()
if (if_is_up) {
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) >= 0
+ if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) == 0
&& ((ifr.ifr_flags & IFF_UP) != 0)) {
ifr.ifr_flags &= ~IFF_UP;
ioctl(sockfd, SIOCSIFFLAGS, &ifr);
@@ -225,11 +225,11 @@ ppp_available()
struct ifreq ifr;
extern char *no_ppp_msg;
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
return 1; /* can't tell */
strlcpy(ifr.ifr_name, "ppp0", sizeof(ifr.ifr_name));
- ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) >= 0;
+ ok = ioctl(s, SIOCGIFFLAGS, (caddr_t) &ifr) == 0;
close(s);
no_ppp_msg = "\
@@ -252,7 +252,7 @@ establish_ppp(fd)
/*
* Demand mode - prime the old ppp device to relinquish the unit.
*/
- if (ioctl(ppp_fd, PPPIOCXFERUNIT, 0) < 0) {
+ if (ioctl(ppp_fd, PPPIOCXFERUNIT, 0) == -1) {
syslog(LOG_ERR, "ioctl(transfer ppp unit): %m");
die(1);
}
@@ -261,11 +261,11 @@ establish_ppp(fd)
/*
* Save the old line discipline of fd, and set it to PPP.
*/
- if (ioctl(fd, TIOCGETD, &initdisc) < 0) {
+ if (ioctl(fd, TIOCGETD, &initdisc) == -1) {
syslog(LOG_ERR, "ioctl(TIOCGETD): %m");
die(1);
}
- if (ioctl(fd, TIOCSETD, &pppdisc) < 0) {
+ if (ioctl(fd, TIOCSETD, &pppdisc) == -1) {
syslog(LOG_ERR, "ioctl(TIOCSETD): %m");
die(1);
}
@@ -274,7 +274,7 @@ establish_ppp(fd)
/*
* Find out which interface we were given.
*/
- if (ioctl(fd, PPPIOCGUNIT, &ifunit) < 0) {
+ if (ioctl(fd, PPPIOCGUNIT, &ifunit) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m");
die(1);
}
@@ -282,7 +282,7 @@ establish_ppp(fd)
/*
* Check that we got the same unit again.
*/
- if (ioctl(fd, PPPIOCGUNIT, &x) < 0) {
+ if (ioctl(fd, PPPIOCGUNIT, &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m");
die(1);
}
@@ -301,11 +301,11 @@ establish_ppp(fd)
* Enable debug in the driver if requested.
*/
if (kdebugflag) {
- if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_WARNING, "ioctl (PPPIOCGFLAGS): %m");
} else {
x |= (kdebugflag & 0xFF) * SC_DEBUG;
- if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) < 0)
+ if (ioctl(fd, PPPIOCSFLAGS, (caddr_t) &x) == -1)
syslog(LOG_WARNING, "ioctl(PPPIOCSFLAGS): %m");
}
}
@@ -330,12 +330,12 @@ restore_loop()
/*
* Transfer the ppp interface back to the loopback.
*/
- if (ioctl(ppp_fd, PPPIOCXFERUNIT, 0) < 0) {
+ if (ioctl(ppp_fd, PPPIOCXFERUNIT, 0) == -1) {
syslog(LOG_ERR, "ioctl(transfer ppp unit): %m");
die(1);
}
x = PPPDISC;
- if (ioctl(loop_slave, TIOCSETD, &x) < 0) {
+ if (ioctl(loop_slave, TIOCSETD, &x) == -1) {
syslog(LOG_ERR, "ioctl(TIOCSETD): %m");
die(1);
}
@@ -343,7 +343,7 @@ restore_loop()
/*
* Check that we got the same unit again.
*/
- if (ioctl(loop_slave, PPPIOCGUNIT, &x) < 0) {
+ if (ioctl(loop_slave, PPPIOCGUNIT, &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m");
die(1);
}
@@ -364,12 +364,12 @@ disestablish_ppp(fd)
int fd;
{
/* Reset non-blocking mode on fd. */
- if (initfdflags != -1 && fcntl(fd, F_SETFL, initfdflags) < 0)
+ if (initfdflags != -1 && fcntl(fd, F_SETFL, initfdflags) == -1)
syslog(LOG_WARNING, "Couldn't restore device fd flags: %m");
initfdflags = -1;
/* Restore old line discipline. */
- if (initdisc >= 0 && ioctl(fd, TIOCSETD, &initdisc) < 0)
+ if (initdisc >= 0 && ioctl(fd, TIOCSETD, &initdisc) == -1)
syslog(LOG_ERR, "ioctl(TIOCSETD): %m");
initdisc = -1;
@@ -422,7 +422,7 @@ set_up_tty(fd, local)
{
struct termios tios;
- if (tcgetattr(fd, &tios) < 0) {
+ if (tcgetattr(fd, &tios) == -1) {
syslog(LOG_ERR, "tcgetattr: %m");
die(1);
}
@@ -470,7 +470,7 @@ set_up_tty(fd, local)
}
baud_rate = inspeed;
- if (tcsetattr(fd, TCSAFLUSH, &tios) < 0) {
+ if (tcsetattr(fd, TCSAFLUSH, &tios) == -1) {
syslog(LOG_ERR, "tcsetattr: %m");
die(1);
}
@@ -495,7 +495,7 @@ restore_tty(fd)
*/
inittermios.c_lflag &= ~(ECHO | ECHONL);
}
- if (tcsetattr(fd, TCSAFLUSH, &inittermios) < 0)
+ if (tcsetattr(fd, TCSAFLUSH, &inittermios) == -1)
if (errno != ENXIO)
syslog(LOG_WARNING, "tcsetattr: %m");
ioctl(fd, TIOCSWINSZ, &wsinfo);
@@ -529,7 +529,7 @@ open_ppp_loopback()
struct termios tios;
int pppdisc = PPPDISC;
- if (openpty(&loop_master, &loop_slave, loop_name, NULL, NULL) < 0) {
+ if (openpty(&loop_master, &loop_slave, loop_name, NULL, NULL) == -1) {
syslog(LOG_ERR, "No free pty for loopback");
die(1);
}
@@ -541,7 +541,7 @@ open_ppp_loopback()
tios.c_iflag = IGNPAR;
tios.c_oflag = 0;
tios.c_lflag = 0;
- if (tcsetattr(loop_slave, TCSAFLUSH, &tios) < 0)
+ if (tcsetattr(loop_slave, TCSAFLUSH, &tios) == -1)
syslog(LOG_WARNING, "couldn't set attributes on loopback: %m");
}
@@ -550,7 +550,7 @@ open_ppp_loopback()
syslog(LOG_WARNING, "couldn't set loopback to nonblock: %m");
ppp_fd = loop_slave;
- if (ioctl(ppp_fd, TIOCSETD, &pppdisc) < 0) {
+ if (ioctl(ppp_fd, TIOCSETD, &pppdisc) == -1) {
syslog(LOG_ERR, "ioctl(TIOCSETD): %m");
die(1);
}
@@ -558,7 +558,7 @@ open_ppp_loopback()
/*
* Find out which interface we were given.
*/
- if (ioctl(ppp_fd, PPPIOCGUNIT, &ifunit) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGUNIT, &ifunit) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCGUNIT): %m");
die(1);
}
@@ -567,11 +567,11 @@ open_ppp_loopback()
* Enable debug in the driver if requested.
*/
if (kdebugflag) {
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &flags) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &flags) == -1) {
syslog(LOG_WARNING, "ioctl (PPPIOCGFLAGS): %m");
} else {
flags |= (kdebugflag & 0xFF) * SC_DEBUG;
- if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &flags) < 0)
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &flags) == -1)
syslog(LOG_WARNING, "ioctl(PPPIOCSFLAGS): %m");
}
}
@@ -591,7 +591,7 @@ output(unit, p, len)
if (debug)
log_packet(p, len, "sent ", LOG_DEBUG);
- if (write(ttyfd, p, len) < 0) {
+ if (write(ttyfd, p, len) == -1) {
if (errno != EIO)
syslog(LOG_ERR, "write: %m");
}
@@ -618,7 +618,7 @@ wait_input(timo)
FD_SET(ttyfd, fdsp);
n = select(ttyfd+1, fdsp, NULL, fdsp, timo);
- if (n < 0 && errno != EINTR) {
+ if (n == -1 && errno != EINTR) {
syslog(LOG_ERR, "select: %m");
free(fdsp);
die(1);
@@ -647,7 +647,7 @@ wait_loop_output(timo)
FD_SET(loop_master, fdsp);
n = select(loop_master + 1, fdsp, NULL, fdsp, timo);
- if (n < 0 && errno != EINTR) {
+ if (n == -1 && errno != EINTR) {
syslog(LOG_ERR, "select: %m");
free(fdsp);
die(1);
@@ -667,7 +667,7 @@ wait_time(timo)
int n;
n = select(0, NULL, NULL, NULL, timo);
- if (n < 0 && errno != EINTR) {
+ if (n == -1 && errno != EINTR) {
syslog(LOG_ERR, "select: %m");
die(1);
}
@@ -683,7 +683,7 @@ read_packet(buf)
{
int len;
- if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) < 0) {
+ if ((len = read(ttyfd, buf, PPP_MTU + PPP_HDRLEN)) == -1) {
if (errno == EWOULDBLOCK || errno == EINTR)
return -1;
syslog(LOG_ERR, "read: %m");
@@ -736,23 +736,23 @@ ppp_send_config(unit, mtu, asyncmap, pcomp, accomp)
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_mtu = mtu;
- if (ioctl(sockfd, SIOCSIFMTU, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCSIFMTU, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR, "ioctl(SIOCSIFMTU): %m");
quit();
}
- if (ioctl(ppp_fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSASYNCMAP, (caddr_t) &asyncmap) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSASYNCMAP): %m");
quit();
}
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
quit();
}
x = pcomp? x | SC_COMP_PROT: x &~ SC_COMP_PROT;
x = accomp? x | SC_COMP_AC: x &~ SC_COMP_AC;
- if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
quit();
}
@@ -767,7 +767,7 @@ ppp_set_xaccm(unit, accm)
int unit;
ext_accm accm;
{
- if (ioctl(ppp_fd, PPPIOCSXASYNCMAP, accm) < 0 && errno != ENOTTY)
+ if (ioctl(ppp_fd, PPPIOCSXASYNCMAP, accm) == -1 && errno != ENOTTY)
syslog(LOG_WARNING, "ioctl(set extended ACCM): %m");
}
@@ -784,20 +784,20 @@ ppp_recv_config(unit, mru, asyncmap, pcomp, accomp)
{
int x;
- if (ioctl(ppp_fd, PPPIOCSMRU, (caddr_t) &mru) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSMRU, (caddr_t) &mru) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSMRU): %m");
quit();
}
- if (ioctl(ppp_fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSRASYNCMAP, (caddr_t) &asyncmap) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSRASYNCMAP): %m");
quit();
}
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
quit();
}
x = !accomp? x | SC_REJ_COMP_AC: x &~ SC_REJ_COMP_AC;
- if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
quit();
}
@@ -833,13 +833,13 @@ ccp_flags_set(unit, isopen, isup)
{
int x;
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
return;
}
x = isopen? x | SC_CCP_OPEN: x &~ SC_CCP_OPEN;
x = isup? x | SC_CCP_UP: x &~ SC_CCP_UP;
- if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0)
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) == -1)
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
}
@@ -854,7 +854,7 @@ ccp_fatal_error(unit)
{
int x;
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCGFLAGS): %m");
return 0;
}
@@ -884,13 +884,13 @@ set_filters(pass, active)
int ret = 1;
if (pass->bf_len > 0) {
- if (ioctl(ppp_fd, PPPIOCSPASS, pass) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSPASS, pass) == -1) {
syslog(LOG_ERR, "Couldn't set pass-filter in kernel: %m");
ret = 0;
}
}
if (active->bf_len > 0) {
- if (ioctl(ppp_fd, PPPIOCSACTIVE, active) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSACTIVE, active) == -1) {
syslog(LOG_ERR, "Couldn't set active-filter in kernel: %m");
ret = 0;
}
@@ -908,17 +908,17 @@ sifvjcomp(u, vjcomp, cidcomp, maxcid)
{
u_int x;
- if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCGFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl (PPPIOCGFLAGS): %m");
return 0;
}
x = vjcomp ? x | SC_COMP_TCP: x &~ SC_COMP_TCP;
x = cidcomp? x & ~SC_NO_TCP_CCID: x | SC_NO_TCP_CCID;
- if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSFLAGS, (caddr_t) &x) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
return 0;
}
- if (vjcomp && ioctl(ppp_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) < 0) {
+ if (vjcomp && ioctl(ppp_fd, PPPIOCSMAXCID, (caddr_t) &maxcid) == -1) {
syslog(LOG_ERR, "ioctl(PPPIOCSFLAGS): %m");
return 0;
}
@@ -935,12 +935,12 @@ sifup(u)
struct ifreq ifr;
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m");
return 0;
}
ifr.ifr_flags |= IFF_UP;
- if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %m");
return 0;
}
@@ -961,7 +961,7 @@ sifnpmode(u, proto, mode)
npi.protocol = proto;
npi.mode = mode;
- if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) < 0) {
+ if (ioctl(ppp_fd, PPPIOCSNPMODE, &npi) == -1) {
syslog(LOG_ERR, "ioctl(set NP %d mode to %d): %m", proto, mode);
return 0;
}
@@ -986,12 +986,12 @@ sifdown(u)
/* ignore errors, because ppp_fd might have been closed by now. */
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCGIFFLAGS, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR, "ioctl (SIOCGIFFLAGS): %m");
rv = 0;
} else {
ifr.ifr_flags &= ~IFF_UP;
- if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCSIFFLAGS, (caddr_t) &ifr) == -1) {
syslog(LOG_ERR, "ioctl(SIOCSIFFLAGS): %m");
rv = 0;
} else
@@ -1033,11 +1033,11 @@ sifaddr(u, o, h, m)
BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask));
BZERO(&ifr, sizeof(ifr));
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
- if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr) < 0) {
+ if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifr) == -1) {
if (errno != EADDRNOTAVAIL)
syslog(LOG_WARNING, "Couldn't remove interface address: %m");
}
- if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) < 0) {
+ if (ioctl(sockfd, SIOCAIFADDR, (caddr_t) &ifra) == -1) {
if (errno != EEXIST) {
syslog(LOG_ERR, "Couldn't set interface address: %m");
return 0;
@@ -1071,7 +1071,7 @@ cifaddr(u, o, h)
SET_SA_FAMILY(ifra.ifra_broadaddr, AF_INET);
((struct sockaddr_in *) &ifra.ifra_broadaddr)->sin_addr.s_addr = h;
BZERO(&ifra.ifra_mask, sizeof(ifra.ifra_mask));
- if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifra) < 0) {
+ if (ioctl(sockfd, SIOCDIFADDR, (caddr_t) &ifra) == -1) {
if (errno != EADDRNOTAVAIL)
syslog(LOG_WARNING, "Couldn't delete interface address: %m");
return 0;
@@ -1117,7 +1117,7 @@ dodefaultroute(g, cmd)
struct sockaddr_in mask;
} rtmsg;
- if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+ if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
syslog(LOG_ERR, "Couldn't %s default route: socket: %m",
cmd=='s'? "add": "delete");
return 0;
@@ -1138,7 +1138,7 @@ dodefaultroute(g, cmd)
rtmsg.mask.sin_family = AF_INET;
rtmsg.hdr.rtm_msglen = sizeof(rtmsg);
- if (write(routes, &rtmsg, sizeof(rtmsg)) < 0) {
+ if (write(routes, &rtmsg, sizeof(rtmsg)) == -1) {
syslog(LOG_ERR, "Couldn't %s default route: %m",
cmd=='s'? "add": "delete");
close(routes);
@@ -1181,7 +1181,7 @@ sifproxyarp(unit, hisaddr)
return 0;
}
- if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+ if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
syslog(LOG_ERR, "Couldn't add proxy arp entry: socket: %m");
return 0;
}
@@ -1199,7 +1199,7 @@ sifproxyarp(unit, hisaddr)
arpmsg.hdr.rtm_msglen = (char *) &arpmsg.hwa - (char *) &arpmsg
+ arpmsg.hwa.sdl_len;
- if (write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) < 0) {
+ if (write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) == -1) {
syslog(LOG_ERR, "Couldn't add proxy arp entry: %m");
close(routes);
return 0;
@@ -1228,12 +1228,12 @@ cifproxyarp(unit, hisaddr)
arpmsg.hdr.rtm_type = RTM_DELETE;
arpmsg.hdr.rtm_seq = ++rtm_seq;
- if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
+ if ((routes = socket(AF_ROUTE, SOCK_RAW, AF_INET)) == -1) {
syslog(LOG_ERR, "Couldn't delete proxy arp entry: socket: %m");
return 0;
}
- if (write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) < 0) {
+ if (write(routes, &arpmsg, arpmsg.hdr.rtm_msglen) == -1) {
syslog(LOG_ERR, "Couldn't delete proxy arp entry: %m");
close(routes);
return 0;
@@ -1277,7 +1277,7 @@ sifproxyarp(unit, hisaddr)
SET_SA_FAMILY(arpreq.arp_pa, AF_INET);
((struct sockaddr_in *) &arpreq.arp_pa)->sin_addr.s_addr = hisaddr;
arpreq.arp_flags = ATF_PERM | ATF_PUBL;
- if (ioctl(sockfd, SIOCSARP, (caddr_t)&arpreq) < 0) {
+ if (ioctl(sockfd, SIOCSARP, (caddr_t)&arpreq) == -1) {
syslog(LOG_ERR, "Couldn't add proxy arp entry: %m");
return 0;
}
@@ -1299,7 +1299,7 @@ cifproxyarp(unit, hisaddr)
BZERO(&arpreq, sizeof(arpreq));
SET_SA_FAMILY(arpreq.arp_pa, AF_INET);
((struct sockaddr_in *) &arpreq.arp_pa)->sin_addr.s_addr = hisaddr;
- if (ioctl(sockfd, SIOCDARP, (caddr_t)&arpreq) < 0) {
+ if (ioctl(sockfd, SIOCDARP, (caddr_t)&arpreq) == -1) {
syslog(LOG_WARNING, "Couldn't delete proxy arp entry: %m");
return 0;
}
@@ -1458,7 +1458,7 @@ lock(dev)
if (asprintf(&lock_file, "%s%s", LOCK_PREFIX, dev) == -1)
novm("lock file name");
- while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) {
+ while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) == -1) {
if (errno == EEXIST
&& (fd = open(lock_file, O_RDONLY, 0)) >= 0) {
/* Read the lock file to find out who has the device locked */
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 62ef9b988b4..40555109559 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_mkdb.c,v 1.55 2018/10/09 12:33:40 millert Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.56 2019/06/28 13:32:49 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -265,7 +265,7 @@ main(int argc, char **argv)
if (makeold) {
(void)snprintf(buf, sizeof(buf), "%s.orig", pname);
if ((tfd = open(buf,
- O_WRONLY|O_CREAT|O_EXCL, PERM_INSECURE)) < 0)
+ O_WRONLY|O_CREAT|O_EXCL, PERM_INSECURE)) == -1)
fatal("%s", buf);
if ((oldfp = fdopen(tfd, "w")) == NULL)
fatal("%s", buf);
@@ -386,16 +386,16 @@ cp(char *from, char *to, mode_t mode)
static char buf[MAXBSIZE];
int from_fd, rcount, to_fd, wcount;
- if ((from_fd = open(from, O_RDONLY, 0)) < 0)
+ if ((from_fd = open(from, O_RDONLY, 0)) == -1)
fatal("%s", from);
- if ((to_fd = open(to, O_WRONLY|O_CREAT|O_EXCL, mode)) < 0)
+ if ((to_fd = open(to, O_WRONLY|O_CREAT|O_EXCL, mode)) == -1)
fatal("%s", to);
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
wcount = write(to_fd, buf, rcount);
if (rcount != wcount || wcount == -1)
fatal("%s to %s", from, to);
}
- if (rcount < 0)
+ if (rcount == -1)
fatal("%s to %s", from, to);
close(to_fd);
close(from_fd);
diff --git a/usr.sbin/rad/frontend.c b/usr.sbin/rad/frontend.c
index 193b9b52f75..8178b058629 100644
--- a/usr.sbin/rad/frontend.c
+++ b/usr.sbin/rad/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.29 2019/05/10 01:29:31 guenther Exp $ */
+/* $OpenBSD: frontend.c,v 1.30 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -200,7 +200,7 @@ frontend(int debug, int verbose)
fatal("can't drop privileges");
/* XXX pass in from main */
- if ((ioctlsock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0)
+ if ((ioctlsock = socket(AF_INET6, SOCK_DGRAM | SOCK_CLOEXEC, 0)) == -1)
fatal("socket");
if (pledge("stdio inet unix recvfd route mcast", NULL) == -1)
@@ -606,7 +606,7 @@ icmp6_receive(int fd, short events, void *arg)
int if_index = 0, *hlimp = NULL;
char ntopbuf[INET6_ADDRSTRLEN], ifnamebuf[IFNAMSIZ];
- if ((len = recvmsg(fd, &icmp6ev.rcvmhdr, 0)) < 0) {
+ if ((len = recvmsg(fd, &icmp6ev.rcvmhdr, 0)) == -1) {
log_warn("recvmsg");
return;
}
@@ -908,7 +908,7 @@ get_interface_prefixes(struct ra_iface *ra_iface, struct ra_prefix_conf
sizeof(ifr6.ifr_name));
memcpy(&ifr6.ifr_addr, sin6, sizeof(ifr6.ifr_addr));
- if (ioctl(ioctlsock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) < 0)
+ if (ioctl(ioctlsock, SIOCGIFNETMASK_IN6, (caddr_t)&ifr6) == -1)
continue; /* addr got deleted while we were looking */
prefixlen = in6_mask2prefixlen(&((struct sockaddr_in6 *)
@@ -1158,7 +1158,7 @@ ra_output(struct ra_iface *ra_iface, struct sockaddr_in6 *to)
log_debug("send RA on %s", ra_iface->name);
len = sendmsg(icmp6sock, &sndmhdr, 0);
- if (len < 0)
+ if (len == -1)
log_warn("sendmsg on %s", ra_iface->name);
}
diff --git a/usr.sbin/rad/rad.c b/usr.sbin/rad/rad.c
index f4e96ab319e..93675167b6b 100644
--- a/usr.sbin/rad/rad.c
+++ b/usr.sbin/rad/rad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rad.c,v 1.20 2019/03/31 03:36:18 yasuoka Exp $ */
+/* $OpenBSD: rad.c,v 1.21 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -260,19 +260,19 @@ main(int argc, char *argv[])
fatal("could not establish imsg links");
if ((icmp6sock = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC,
- IPPROTO_ICMPV6)) < 0)
+ IPPROTO_ICMPV6)) == -1)
fatal("ICMPv6 socket");
if (setsockopt(icmp6sock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
fatal("IPV6_RECVPKTINFO");
if (setsockopt(icmp6sock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
fatal("IPV6_RECVHOPLIMIT");
if (setsockopt(icmp6sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &off,
- sizeof(off)) < 0)
+ sizeof(off)) == -1)
fatal("IPV6_RECVHOPLIMIT");
/* only router advertisements and solicitations */
@@ -284,13 +284,13 @@ main(int argc, char *argv[])
fatal("ICMP6_FILTER");
if ((frontend_routesock = socket(AF_ROUTE, SOCK_RAW | SOCK_CLOEXEC,
- AF_INET6)) < 0)
+ AF_INET6)) == -1)
fatal("route socket");
rtfilter = ROUTE_FILTER(RTM_IFINFO) | ROUTE_FILTER(RTM_NEWADDR) |
ROUTE_FILTER(RTM_DELADDR);
if (setsockopt(frontend_routesock, AF_ROUTE, ROUTE_MSGFILTER,
- &rtfilter, sizeof(rtfilter)) < 0)
+ &rtfilter, sizeof(rtfilter)) == -1)
fatal("setsockopt(ROUTE_MSGFILTER)");
if ((control_fd = control_init(csock)) == -1)
diff --git a/usr.sbin/radiusd/radiusd.c b/usr.sbin/radiusd/radiusd.c
index 33d7bf6c9e9..4b01b310dbc 100644
--- a/usr.sbin/radiusd/radiusd.c
+++ b/usr.sbin/radiusd/radiusd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiusd.c,v 1.26 2019/04/03 11:54:56 yasuoka Exp $ */
+/* $OpenBSD: radiusd.c,v 1.27 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2013 Internet Initiative Japan Inc.
@@ -202,7 +202,7 @@ radiusd_start(struct radiusd *radiusd)
goto on_error;
}
if ((s = socket(l->addr.ipv4.sin_family,
- l->stype | SOCK_NONBLOCK, l->sproto)) < 0) {
+ l->stype | SOCK_NONBLOCK, l->sproto)) == -1) {
log_warn("Listen %s port %d is failed: socket()",
hbuf, (int)htons(l->addr.ipv4.sin_port));
goto on_error;
@@ -362,7 +362,7 @@ radiusd_listen_on_event(int fd, short evmask, void *ctx)
if (evmask & EV_READ) {
peersz = sizeof(peer);
if ((sz = recvfrom(listn->sock, buf, sizeof(buf), 0,
- (struct sockaddr *)&peer, &peersz)) < 0) {
+ (struct sockaddr *)&peer, &peersz)) == -1) {
if (errno == EAGAIN)
return;
log_warn("%s: recvfrom() failed", __func__);
@@ -956,12 +956,12 @@ radiusd_module_load(struct radiusd *radiusd, const char *path, const char *name)
close(pairsock[1]);
module->fd = pairsock[0];
- if ((ival = fcntl(module->fd, F_GETFL)) < 0) {
+ if ((ival = fcntl(module->fd, F_GETFL)) == -1) {
log_warn("Could not load module `%s': fcntl(F_GETFL)",
name);
goto on_error;
}
- if (fcntl(module->fd, F_SETFL, ival | O_NONBLOCK) < 0) {
+ if (fcntl(module->fd, F_SETFL, ival | O_NONBLOCK) == -1) {
log_warn("Could not load module `%s': fcntl(F_SETFL,O_NONBLOCK)",
name);
goto on_error;
diff --git a/usr.sbin/radiusd/radiusd_module.c b/usr.sbin/radiusd/radiusd_module.c
index 43e72d0c2ca..f38170af91b 100644
--- a/usr.sbin/radiusd/radiusd_module.c
+++ b/usr.sbin/radiusd/radiusd_module.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiusd_module.c,v 1.12 2019/04/03 11:54:56 yasuoka Exp $ */
+/* $OpenBSD: radiusd_module.c,v 1.13 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -102,9 +102,9 @@ module_start(struct module_base *base)
#ifdef USE_LIBEVENT
int ival;
- if ((ival = fcntl(base->ibuf.fd, F_GETFL)) < 0)
+ if ((ival = fcntl(base->ibuf.fd, F_GETFL)) == -1)
err(1, "Failed to F_GETFL");
- if (fcntl(base->ibuf.fd, F_SETFL, ival | O_NONBLOCK) < 0)
+ if (fcntl(base->ibuf.fd, F_SETFL, ival | O_NONBLOCK) == -1)
err(1, "Failed to setup NONBLOCK");
event_set(&base->ev, base->ibuf.fd, EV_READ, module_on_event, base);
event_add(&base->ev, NULL);
diff --git a/usr.sbin/radiusd/radiusd_radius.c b/usr.sbin/radiusd/radiusd_radius.c
index 3e35fc1b731..af83969dbb6 100644
--- a/usr.sbin/radiusd/radiusd_radius.c
+++ b/usr.sbin/radiusd/radiusd_radius.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radiusd_radius.c,v 1.16 2019/04/01 11:05:41 yasuoka Exp $ */
+/* $OpenBSD: radiusd_radius.c,v 1.17 2019/06/28 13:32:49 deraadt Exp $ */
/*
* Copyright (c) 2013 Internet Initiative Japan Inc.
@@ -342,7 +342,7 @@ radius_server_start(struct radius_server *server)
char buf1[NI_MAXHOST + NI_MAXSERV + 32];
if ((server->sock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0))
- < 0) {
+ == -1) {
module_radius_log(server->module, LOG_WARNING,
"%s: socket() failed", __func__);
goto on_error;
diff --git a/usr.sbin/rarpd/arptab.c b/usr.sbin/rarpd/arptab.c
index 86e86e70e9c..711f1c2cef0 100644
--- a/usr.sbin/rarpd/arptab.c
+++ b/usr.sbin/rarpd/arptab.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arptab.c,v 1.30 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: arptab.c,v 1.31 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 1984, 1993
@@ -73,7 +73,7 @@ void
arptab_init(void)
{
s = socket(AF_ROUTE, SOCK_RAW, 0);
- if (s < 0)
+ if (s == -1)
err(1, "arp: socket");
}
@@ -217,7 +217,7 @@ doit:
l = rtm->rtm_msglen;
rtm->rtm_seq = ++seq;
rtm->rtm_type = cmd;
- if (write(s, (char *)&m_rtmsg, l) < 0) {
+ if (write(s, (char *)&m_rtmsg, l) == -1) {
if (errno != ESRCH && errno != EEXIST) {
syslog(LOG_ERR, "writing to routing socket: %m");
return (-1);
@@ -227,7 +227,7 @@ doit:
l = recv(s, (char *)&m_rtmsg, sizeof(m_rtmsg), MSG_DONTWAIT);
} while (l > 0 && (rtm->rtm_version != RTM_VERSION ||
rtm->rtm_seq != seq || rtm->rtm_pid != pid));
- if (l < 0) {
+ if (l == -1) {
if (errno == EAGAIN || errno == EINTR)
goto retry;
syslog(LOG_ERR, "arptab_set: read from routing socket: %m");
diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c
index 56d98844420..f3227883404 100644
--- a/usr.sbin/rarpd/rarpd.c
+++ b/usr.sbin/rarpd/rarpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rarpd.c,v 1.75 2018/08/07 18:39:56 deraadt Exp $ */
+/* $OpenBSD: rarpd.c,v 1.76 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */
/*
@@ -251,12 +251,12 @@ rarp_open(char *device)
/* Set immediate mode so packets are processed as they arrive. */
immediate = 1;
- if (ioctl(fd, BIOCIMMEDIATE, &immediate) < 0) {
+ if (ioctl(fd, BIOCIMMEDIATE, &immediate) == -1) {
error("BIOCIMMEDIATE: %s", strerror(errno));
}
(void) strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name);
- if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) < 0) {
+ if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) == -1) {
if (aflag) { /* for -a skip not ethernet interfaces */
close(fd);
return -1;
@@ -268,7 +268,7 @@ rarp_open(char *device)
* Check that the data link layer is an Ethernet; this code
* won't work with anything else.
*/
- if (ioctl(fd, BIOCGDLT, (caddr_t) &dlt) < 0)
+ if (ioctl(fd, BIOCGDLT, (caddr_t) &dlt) == -1)
error("BIOCGDLT: %s", strerror(errno));
if (dlt != DLT_EN10MB) {
if (aflag) { /* for -a skip not ethernet interfaces */
@@ -278,7 +278,7 @@ rarp_open(char *device)
error("%s is not an ethernet", device);
}
/* Set filter program. */
- if (ioctl(fd, BIOCSETF, (caddr_t)&filter) < 0)
+ if (ioctl(fd, BIOCSETF, (caddr_t)&filter) == -1)
error("BIOCSETF: %s", strerror(errno));
return fd;
}
@@ -333,7 +333,7 @@ rarp_loop(void)
if (iflist == 0)
error("no interfaces");
- if (ioctl(iflist->ii_fd, BIOCGBLEN, (caddr_t)&bufsize) < 0)
+ if (ioctl(iflist->ii_fd, BIOCGBLEN, (caddr_t)&bufsize) == -1)
error("BIOCGBLEN: %s", strerror(errno));
arptab_init();
@@ -374,9 +374,9 @@ rarp_loop(void)
again:
cc = read(fd, (char *)buf, bufsize);
/* Don't choke when we get ptraced */
- if (cc < 0 && errno == EINTR)
+ if (cc == -1 && errno == EINTR)
goto again;
- if (cc < 0)
+ if (cc == -1)
error("read: %s", strerror(errno));
/* Loop through the packet(s) */
#define bhp ((struct bpf_hdr *)bp)
diff --git a/usr.sbin/rbootd/bpf.c b/usr.sbin/rbootd/bpf.c
index 069253c0973..5ada9b29bed 100644
--- a/usr.sbin/rbootd/bpf.c
+++ b/usr.sbin/rbootd/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.26 2017/04/19 05:36:13 natano Exp $ */
+/* $OpenBSD: bpf.c,v 1.27 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */
/*
@@ -94,7 +94,7 @@ BpfOpen(void)
* type and make sure it's type Ethernet.
*/
(void) strncpy(ifr.ifr_name, IntfName, sizeof(ifr.ifr_name));
- if (ioctl(BpfFd, BIOCSETIF, (caddr_t)&ifr) < 0) {
+ if (ioctl(BpfFd, BIOCSETIF, (caddr_t)&ifr) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCSETIF,%s): %m", IntfName);
DoExit();
}
@@ -102,7 +102,7 @@ BpfOpen(void)
/*
* Make sure we are dealing with an Ethernet device.
*/
- if (ioctl(BpfFd, BIOCGDLT, (caddr_t)&n) < 0) {
+ if (ioctl(BpfFd, BIOCGDLT, (caddr_t)&n) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCGDLT): %m");
DoExit();
}
@@ -116,7 +116,7 @@ BpfOpen(void)
* On read(), return packets immediately (do not buffer them).
*/
n = 1;
- if (ioctl(BpfFd, BIOCIMMEDIATE, (caddr_t)&n) < 0) {
+ if (ioctl(BpfFd, BIOCIMMEDIATE, (caddr_t)&n) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCIMMEDIATE): %m");
DoExit();
}
@@ -132,11 +132,11 @@ BpfOpen(void)
#endif
ifr.ifr_addr.sa_family = AF_UNSPEC;
bcopy(&RmpMcastAddr[0], (char *)&ifr.ifr_addr.sa_data[0], RMP_ADDRLEN);
- if (ioctl(BpfFd, SIOCADDMULTI, (caddr_t)&ifr) < 0) {
+ if (ioctl(BpfFd, SIOCADDMULTI, (caddr_t)&ifr) == -1) {
syslog(LOG_WARNING,
"bpf: can't add mcast addr (%m), setting promiscuous mode");
- if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) {
+ if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) == -1) {
syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m");
DoExit();
}
@@ -145,7 +145,7 @@ BpfOpen(void)
/*
* Ask BPF how much buffer space it requires and allocate one.
*/
- if (ioctl(BpfFd, BIOCGBLEN, (caddr_t)&BpfLen) < 0) {
+ if (ioctl(BpfFd, BIOCGBLEN, (caddr_t)&BpfLen) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCGBLEN): %m");
DoExit();
}
@@ -213,17 +213,17 @@ BpfOpen(void)
sizeof(bpf_wf_insn)/sizeof(bpf_wf_insn[0]), bpf_wf_insn
};
- if (ioctl(BpfFd, BIOCSETF, (caddr_t)&bpf_pgm) < 0) {
+ if (ioctl(BpfFd, BIOCSETF, (caddr_t)&bpf_pgm) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCSETF): %m");
DoExit();
}
- if (ioctl(BpfFd, BIOCSETWF, (caddr_t)&bpf_w_pgm) < 0) {
+ if (ioctl(BpfFd, BIOCSETWF, (caddr_t)&bpf_w_pgm) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCSETWF): %m");
DoExit();
}
- if (ioctl(BpfFd, BIOCLOCK) < 0) {
+ if (ioctl(BpfFd, BIOCLOCK) == -1) {
syslog(LOG_ERR, "bpf: ioctl(BIOCLOCK): %m");
DoExit();
}
@@ -324,7 +324,7 @@ BpfRead(RMPCONN *rconn, int doread)
* We let the caller decide whether or not we can issue a read().
*/
if (doread) {
- if ((cc = read(BpfFd, (char *)BpfPkt, (int)BpfLen)) < 0) {
+ if ((cc = read(BpfFd, (char *)BpfPkt, (int)BpfLen)) == -1) {
syslog(LOG_ERR, "bpf: read: %m");
return(0);
} else {
@@ -379,7 +379,7 @@ BpfRead(RMPCONN *rconn, int doread)
int
BpfWrite(RMPCONN *rconn)
{
- if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) < 0) {
+ if (write(BpfFd, (char *)&rconn->rmp, rconn->rmplen) == -1) {
syslog(LOG_ERR, "write: %s: %m", EnetStr(rconn));
return(0);
}
diff --git a/usr.sbin/rbootd/parseconf.c b/usr.sbin/rbootd/parseconf.c
index 4739c15d9eb..2563ce9b59a 100644
--- a/usr.sbin/rbootd/parseconf.c
+++ b/usr.sbin/rbootd/parseconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parseconf.c,v 1.13 2016/05/29 02:19:02 guenther Exp $ */
+/* $OpenBSD: parseconf.c,v 1.14 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: parseconf.c,v 1.4 1995/10/06 05:12:16 thorpej Exp $ */
/*
@@ -320,7 +320,7 @@ GetBootFiles(void)
*/
i = 0;
for (dp = readdir(dfd); dp != NULL; dp = readdir(dfd)) {
- if (stat(dp->d_name, &statb) < 0 ||
+ if (stat(dp->d_name, &statb) == -1 ||
(statb.st_mode & S_IFMT) != S_IFREG)
continue;
if (i == C_MAXFILE)
diff --git a/usr.sbin/rbootd/rbootd.c b/usr.sbin/rbootd/rbootd.c
index 5c1dbee3edc..a1c4050b164 100644
--- a/usr.sbin/rbootd/rbootd.c
+++ b/usr.sbin/rbootd/rbootd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbootd.c,v 1.31 2016/05/29 02:19:02 guenther Exp $ */
+/* $OpenBSD: rbootd.c,v 1.32 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: rbootd.c,v 1.5 1995/10/06 05:12:17 thorpej Exp $ */
/*
@@ -159,7 +159,7 @@ main(int argc, char *argv[])
* All boot files are relative to the boot directory, we might
* as well chdir() there to make life easier.
*/
- if (chdir(BootDir) < 0) {
+ if (chdir(BootDir) == -1) {
syslog(LOG_ERR, "chdir: %m (%s)", BootDir);
DoExit();
}
@@ -215,7 +215,7 @@ main(int argc, char *argv[])
nsel = poll(pfd, 1, RmpConns ? RMP_TIMEOUT * 100 : -1);
- if (nsel < 0) {
+ if (nsel == -1) {
if (errno == EINTR)
continue;
syslog(LOG_ERR, "poll: %m");
diff --git a/usr.sbin/rbootd/rmpproto.c b/usr.sbin/rbootd/rmpproto.c
index 74d8277b9b6..268fc2e780b 100644
--- a/usr.sbin/rbootd/rmpproto.c
+++ b/usr.sbin/rbootd/rmpproto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rmpproto.c,v 1.12 2016/03/16 15:41:11 krw Exp $ */
+/* $OpenBSD: rmpproto.c,v 1.13 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: rmpproto.c,v 1.5.2.1 1995/11/14 08:45:44 thorpej Exp $ */
/*
@@ -355,7 +355,7 @@ match:
* "too many open files" - RMP_E_BUSY
* anything else - RMP_E_OPENFILE
*/
- if ((rconn->bootfd = open(filename, O_RDONLY, 0600)) < 0) {
+ if ((rconn->bootfd = open(filename, O_RDONLY, 0600)) == -1) {
rpl->r_brpl.rmp_retcode = (errno == ENOENT)? RMP_E_NOFILE:
(errno == EMFILE || errno == ENFILE)? RMP_E_BUSY:
RMP_E_OPENFILE;
@@ -444,7 +444,7 @@ SendReadRepl(RMPCONN *rconn)
* Position read head on file according to info in request packet.
*/
GETWORD(req->r_rrq.rmp_offset, size);
- if (lseek(oldconn->bootfd, (off_t)size, SEEK_SET) < 0) {
+ if (lseek(oldconn->bootfd, (off_t)size, SEEK_SET) == -1) {
syslog(LOG_ERR, "SendReadRepl: lseek: %m (%s)",
EnetStr(rconn));
rpl->r_rrpl.rmp_retcode = RMP_E_ABORT;
@@ -457,7 +457,7 @@ SendReadRepl(RMPCONN *rconn)
*/
if ((size = read(oldconn->bootfd, &rpl->r_rrpl.rmp_data,
(int) ntohs(req->r_rrq.rmp_size))) <= 0) {
- if (size < 0) {
+ if (size == -1) {
syslog(LOG_ERR, "SendReadRepl: read: %m (%s)",
EnetStr(rconn));
rpl->r_rrpl.rmp_retcode = RMP_E_ABORT;
diff --git a/usr.sbin/rdate/ntp.c b/usr.sbin/rdate/ntp.c
index 547bdd98e53..d48b6cae19e 100644
--- a/usr.sbin/rdate/ntp.c
+++ b/usr.sbin/rdate/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.34 2018/08/18 15:25:20 mestre Exp $ */
+/* $OpenBSD: ntp.c,v 1.35 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved.
@@ -146,7 +146,7 @@ ntp_client(const char *hostname, int family, struct timeval *new,
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)
continue;
ret = sync_ntp(s, res->ai_addr, &offset, &error);
@@ -188,7 +188,7 @@ sync_ntp(int fd, const struct sockaddr *peer, double *offset, double *error)
*offset = 0.0;
*error = NTP_INSANITY;
- if (connect(fd, peer, SA_LEN(peer)) < 0) {
+ if (connect(fd, peer, SA_LEN(peer)) == -1) {
warn("Failed to connect to server");
return (-1);
}
@@ -318,7 +318,7 @@ read_packet(int fd, struct ntp_data *data, double *off, double *error)
retry:
r = poll(pfd, 1, 1000 * MAX_DELAY / MAX_QUERIES);
- if (r < 0) {
+ if (r == -1) {
if (errno == EINTR)
goto retry;
warn("select");
@@ -331,7 +331,7 @@ retry:
return (1);
length = read(fd, receive, NTP_PACKET_MAX);
- if (length < 0) {
+ if (length == -1) {
warn("Unable to receive NTP packet from server");
return (-1);
}
diff --git a/usr.sbin/rdate/rfc868time.c b/usr.sbin/rdate/rfc868time.c
index 2158fb632dc..a7f84fce505 100644
--- a/usr.sbin/rdate/rfc868time.c
+++ b/usr.sbin/rdate/rfc868time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfc868time.c,v 1.11 2018/08/18 15:25:20 mestre Exp $ */
+/* $OpenBSD: rfc868time.c,v 1.12 2019/06/28 13:32:50 deraadt Exp $ */
/* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */
/*
@@ -88,10 +88,10 @@ rfc868time_client(const char *hostname, int family, struct timeval *new,
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)
continue;
- if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+ if (connect(s, res->ai_addr, res->ai_addrlen) == -1) {
close(s);
s = -1;
continue;
@@ -99,7 +99,7 @@ rfc868time_client(const char *hostname, int family, struct timeval *new,
break;
}
- if (s < 0)
+ if (s == -1)
err(1, "Could not connect socket");
freeaddrinfo(res0);
diff --git a/usr.sbin/relayd/check_icmp.c b/usr.sbin/relayd/check_icmp.c
index 1b2557c25fc..3d251b28651 100644
--- a/usr.sbin/relayd/check_icmp.c
+++ b/usr.sbin/relayd/check_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check_icmp.c,v 1.47 2017/07/12 22:57:40 jca Exp $ */
+/* $OpenBSD: check_icmp.c,v 1.48 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -52,7 +52,7 @@ icmp_setup(struct relayd *env, struct ctl_icmp_event *cie, int af)
if (af == AF_INET6)
proto = IPPROTO_ICMPV6;
- if ((cie->s = socket(af, SOCK_RAW | SOCK_NONBLOCK, proto)) < 0)
+ if ((cie->s = socket(af, SOCK_RAW | SOCK_NONBLOCK, proto)) == -1)
fatal("%s: socket", __func__);
val = ICMP_RCVBUF_SIZE;
if (setsockopt(cie->s, SOL_SOCKET, SO_RCVBUF, &val, sizeof(val)) == -1)
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index 6cdbba67d5f..0d46ae20095 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.238 2019/05/31 15:25:57 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.239 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -3385,7 +3385,7 @@ is_if_in_group(const char *ifname, const char *groupname)
int s;
int ret = 0;
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
memset(&ifgr, 0, sizeof(ifgr));
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 7ec8f0ec41a..864d9104fbe 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.248 2019/06/26 12:13:47 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.249 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -2504,7 +2504,7 @@ relay_tls_readcb(int fd, short event, void *arg)
ret = tls_read(cre->tls, rbuf, howmuch);
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) {
goto retry;
- } else if (ret < 0) {
+ } else if (ret == -1) {
what |= EVBUFFER_ERROR;
goto err;
}
@@ -2563,7 +2563,7 @@ relay_tls_writecb(int fd, short event, void *arg)
EVBUFFER_LENGTH(bufev->output));
if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) {
goto retry;
- } else if (ret < 0) {
+ } else if (ret == -1) {
what |= EVBUFFER_ERROR;
goto err;
}
diff --git a/usr.sbin/ripd/interface.c b/usr.sbin/ripd/interface.c
index 79b2424243d..a176e1368cc 100644
--- a/usr.sbin/ripd/interface.c
+++ b/usr.sbin/ripd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.14 2017/01/17 16:30:54 jca Exp $ */
+/* $OpenBSD: interface.c,v 1.15 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -257,7 +257,7 @@ int
if_set_mcast_ttl(int fd, u_int8_t ttl)
{
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *)&ttl, sizeof(ttl)) < 0) {
+ (char *)&ttl, sizeof(ttl)) == -1) {
log_warn("if_set_mcast_ttl: error setting "
"IP_MULTICAST_TTL to %d", ttl);
return (-1);
@@ -272,7 +272,7 @@ if_set_opt(int fd)
int yes = 1;
if (setsockopt(fd, IPPROTO_IP, IP_RECVIF, &yes,
- sizeof(int)) < 0) {
+ sizeof(int)) == -1) {
log_warn("if_set_opt: error setting IP_RECVIF");
return (-1);
}
@@ -284,7 +284,7 @@ int
if_set_tos(int fd, int tos)
{
if (setsockopt(fd, IPPROTO_IP, IP_TOS,
- (int *)&tos, sizeof(tos)) < 0) {
+ (int *)&tos, sizeof(tos)) == -1) {
log_warn("if_set_tos: error setting IP_TOS to 0x%x", tos);
return (-1);
}
@@ -299,7 +299,7 @@ if_set_mcast(struct iface *iface)
case IF_TYPE_POINTOPOINT:
case IF_TYPE_BROADCAST:
if (setsockopt(iface->fd, IPPROTO_IP, IP_MULTICAST_IF,
- &iface->addr.s_addr, sizeof(iface->addr.s_addr)) < 0) {
+ &iface->addr.s_addr, sizeof(iface->addr.s_addr)) == -1) {
log_debug("if_set_mcast: error setting "
"IP_MULTICAST_IF, interface %s", iface->name);
return (-1);
@@ -318,7 +318,7 @@ if_set_mcast_loop(int fd)
u_int8_t loop = 0;
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
- (char *)&loop, sizeof(loop)) < 0) {
+ (char *)&loop, sizeof(loop)) == -1) {
log_warn("if_set_mcast_loop: error setting IP_MULTICAST_LOOP");
return (-1);
}
@@ -349,7 +349,7 @@ if_join_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0)
+ (void *)&mreq, sizeof(mreq)) == -1)
return (-1);
break;
default:
@@ -371,7 +371,7 @@ if_leave_group(struct iface *iface, struct in_addr *addr)
mreq.imr_interface.s_addr = iface->addr.s_addr;
if (setsockopt(iface->fd, IPPROTO_IP, IP_DROP_MEMBERSHIP,
- (void *)&mreq, sizeof(mreq)) < 0)
+ (void *)&mreq, sizeof(mreq)) == -1)
return (-1);
break;
default:
@@ -406,7 +406,7 @@ if_new(struct kif *kif)
/* set up ifreq */
strlcpy(ifr->ifr_name, kif->ifname, sizeof(ifr->ifr_name));
if ((s = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
- 0)) < 0)
+ 0)) == -1)
err(1, "if_new: socket");
/* get type */
@@ -429,20 +429,20 @@ if_new(struct kif *kif)
iface->baudrate = kif->baudrate;
/* get address */
- if (ioctl(s, SIOCGIFADDR, ifr) < 0)
+ if (ioctl(s, SIOCGIFADDR, ifr) == -1)
err(1, "if_new: cannot get address");
sain = (struct sockaddr_in *)&ifr->ifr_addr;
iface->addr = sain->sin_addr;
/* get mask */
- if (ioctl(s, SIOCGIFNETMASK, ifr) < 0)
+ if (ioctl(s, SIOCGIFNETMASK, ifr) == -1)
err(1, "if_new: cannot get mask");
sain = (struct sockaddr_in *)&ifr->ifr_addr;
iface->mask = sain->sin_addr;
/* get p2p dst address */
if (kif->flags & IFF_POINTOPOINT) {
- if (ioctl(s, SIOCGIFDSTADDR, ifr) < 0)
+ if (ioctl(s, SIOCGIFDSTADDR, ifr) == -1)
err(1, "if_new: cannot get dst addr");
sain = (struct sockaddr_in *)&ifr->ifr_addr;
iface->dst = sain->sin_addr;
diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c
index d1542b3083d..eaeba84c0a4 100644
--- a/usr.sbin/rmt/rmt.c
+++ b/usr.sbin/rmt/rmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rmt.c,v 1.22 2019/02/10 16:42:35 phessler Exp $ */
+/* $OpenBSD: rmt.c,v 1.23 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -228,7 +228,7 @@ top:
}
}
rval = write(tape, record, n);
- if (rval < 0)
+ if (rval == -1)
goto ioerror;
goto respond;
@@ -238,7 +238,7 @@ top:
n = atoi(count);
record = checkbuf(record, n);
rval = read(tape, record, n);
- if (rval < 0)
+ if (rval == -1)
goto ioerror;
(void) snprintf(resp, sizeof resp, "A%d\n", rval);
(void) write(STDOUT_FILENO, resp, strlen(resp));
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index e33a17ae3bf..ee1cf0b6d1c 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route6d.c,v 1.98 2019/01/22 09:25:29 krw Exp $ */
+/* $OpenBSD: route6d.c,v 1.99 2019/06/28 13:32:50 deraadt Exp $ */
/* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */
/*
@@ -300,7 +300,7 @@ main(int argc, char *argv[])
}
if (dflag == 0) {
- if (daemon(0, 0) < 0) {
+ if (daemon(0, 0) == -1) {
fatal("daemon");
/*NOTREACHED*/
}
@@ -530,39 +530,39 @@ init(void)
}
ripsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
- if (ripsock < 0) {
+ if (ripsock == -1) {
fatal("rip socket");
/*NOTREACHED*/
}
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_V6ONLY,
- &int1, sizeof(int1)) < 0) {
+ &int1, sizeof(int1)) == -1) {
fatal("rip IPV6_V6ONLY");
/*NOTREACHED*/
}
- if (bind(ripsock, res->ai_addr, res->ai_addrlen) < 0) {
+ if (bind(ripsock, res->ai_addr, res->ai_addrlen) == -1) {
fatal("rip bind");
/*NOTREACHED*/
}
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
- &int255, sizeof(int255)) < 0) {
+ &int255, sizeof(int255)) == -1) {
fatal("rip IPV6_MULTICAST_HOPS");
/*NOTREACHED*/
}
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
- &int0, sizeof(int0)) < 0) {
+ &int0, sizeof(int0)) == -1) {
fatal("rip IPV6_MULTICAST_LOOP");
/*NOTREACHED*/
}
i = 1;
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &i,
- sizeof(i)) < 0) {
+ sizeof(i)) == -1) {
fatal("rip IPV6_RECVPKTINFO");
/*NOTREACHED*/
}
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT,
- &int1, sizeof(int1)) < 0) {
+ &int1, sizeof(int1)) == -1) {
fatal("rip IPV6_RECVHOPLIMIT");
/*NOTREACHED*/
}
@@ -587,7 +587,7 @@ init(void)
pfd[0].events = POLLIN;
if (nflag == 0) {
- if ((rtsock = socket(AF_ROUTE, SOCK_RAW, 0)) < 0) {
+ if ((rtsock = socket(AF_ROUTE, SOCK_RAW, 0)) == -1) {
fatal("route socket");
/*NOTREACHED*/
}
@@ -927,7 +927,7 @@ sendpacket(struct sockaddr_in6 *sin6, int len)
pi->ipi6_ifindex = idx;
}
- if (sendmsg(ripsock, &m, 0) < 0) {
+ if (sendmsg(ripsock, &m, 0) == -1) {
log_debug("sendmsg: %s", strerror(errno));
return errno;
}
@@ -977,7 +977,7 @@ riprecv(void)
m.msg_iovlen = 1;
m.msg_control = (caddr_t)&cmsgbuf.buf;
m.msg_controllen = sizeof(cmsgbuf.buf);
- if ((len = recvmsg(ripsock, &m, 0)) < 0) {
+ if ((len = recvmsg(ripsock, &m, 0)) == -1) {
fatal("recvmsg");
/*NOTREACHED*/
}
@@ -1359,7 +1359,7 @@ ifconfig(void)
struct ipv6_mreq mreq;
int s;
- if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) {
fatal("socket");
/*NOTREACHED*/
}
@@ -1410,7 +1410,7 @@ ifconfig(void)
mreq.ipv6mr_multiaddr = ifcp->ifc_ripsin.sin6_addr;
mreq.ipv6mr_interface = ifcp->ifc_index;
if (setsockopt(ripsock, IPPROTO_IPV6, IPV6_JOIN_GROUP,
- &mreq, sizeof(mreq)) < 0) {
+ &mreq, sizeof(mreq)) == -1) {
fatalx("IPV6_JOIN_GROUP");
/*NOTREACHED*/
}
@@ -1436,7 +1436,7 @@ ifconfig1(const char *name, const struct sockaddr *sa, struct ifc *ifcp, int s)
return;
ifr.ifr_addr = *sin6;
strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFNETMASK_IN6, (char *)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFNETMASK_IN6, (char *)&ifr) == -1) {
fatal("ioctl: SIOCGIFNETMASK_IN6");
/*NOTREACHED*/
}
@@ -1461,7 +1461,7 @@ ifconfig1(const char *name, const struct sockaddr *sa, struct ifc *ifcp, int s)
ifa->ifa_plen = plen;
if (ifcp->ifc_flags & IFF_POINTOPOINT) {
ifr.ifr_addr = *sin6;
- if (ioctl(s, SIOCGIFDSTADDR_IN6, (char *)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFDSTADDR_IN6, (char *)&ifr) == -1) {
fatal("ioctl: SIOCGIFDSTADDR_IN6");
/*NOTREACHED*/
}
@@ -1483,7 +1483,7 @@ ifconfig1(const char *name, const struct sockaddr *sa, struct ifc *ifcp, int s)
ifcp->ifc_mtu = getifmtu(ifcp->ifc_index);
if (ifcp->ifc_mtu > RIP6_MAXMTU)
ifcp->ifc_mtu = RIP6_MAXMTU;
- if (ioctl(s, SIOCGIFMETRIC, (char *)&ifr) < 0) {
+ if (ioctl(s, SIOCGIFMETRIC, (char *)&ifr) == -1) {
fatal("ioctl: SIOCGIFMETRIC");
/*NOTREACHED*/
}
@@ -1514,7 +1514,7 @@ rtrecv(void)
int i, addrs;
struct riprt *rrt;
- if ((len = read(rtsock, buf, sizeof(buf))) < 0) {
+ if ((len = read(rtsock, buf, sizeof(buf))) == -1) {
perror("read from rtsock");
exit(1);
}
@@ -2368,7 +2368,7 @@ krtread(int again)
free(buf);
buf = NULL;
errmsg = NULL;
- if (sysctl(mib, 6, NULL, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, 6, NULL, &msize, NULL, 0) == -1) {
errmsg = "sysctl estimate";
continue;
}
@@ -2376,7 +2376,7 @@ krtread(int again)
errmsg = "malloc";
continue;
}
- if (sysctl(mib, 6, buf, &msize, NULL, 0) < 0) {
+ if (sysctl(mib, 6, buf, &msize, NULL, 0) == -1) {
errmsg = "sysctl NET_RT_DUMP";
continue;
}
@@ -2687,14 +2687,14 @@ getroute(struct netinfo6 *np, struct in6_addr *gw)
sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_family = AF_INET6;
sin6->sin6_addr = np->rip6_dest;
- if (write(rtsock, buf, len) < 0) {
+ if (write(rtsock, buf, len) == -1) {
if (errno == ESRCH) /* No such route found */
return NULL;
perror("write to rtsock");
exit(1);
}
do {
- if ((len = read(rtsock, buf, sizeof(buf))) < 0) {
+ if ((len = read(rtsock, buf, sizeof(buf))) == -1) {
perror("read from rtsock");
exit(1);
}
diff --git a/usr.sbin/rpc.lockd/lockd_lock.c b/usr.sbin/rpc.lockd/lockd_lock.c
index bd687a7c803..ad4162b8898 100644
--- a/usr.sbin/rpc.lockd/lockd_lock.c
+++ b/usr.sbin/rpc.lockd/lockd_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lockd_lock.c,v 1.9 2015/01/16 06:40:20 deraadt Exp $ */
+/* $OpenBSD: lockd_lock.c,v 1.10 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2000 Manuel Bouyer.
@@ -508,7 +508,7 @@ do_lock(struct file_lock *fl, int block)
struct stat st;
fl->fd = fhopen((fhandle_t *)fl->filehandle.fhdata, O_RDWR);
- if (fl->fd < 0) {
+ if (fl->fd == -1) {
switch (errno) {
case ESTALE:
error = nlm4_stale_fh;
@@ -526,7 +526,7 @@ do_lock(struct file_lock *fl, int block)
LIST_REMOVE(fl, lcklst);
return error;
}
- if (fstat(fl->fd, &st) < 0) {
+ if (fstat(fl->fd, &st) == -1) {
syslog(LOG_NOTICE, "fstat failed (from %s) (%m)",
fl->client_name);
}
@@ -738,7 +738,7 @@ siglock(void)
sigemptyset(&block);
sigaddset(&block, SIGCHLD);
- if (sigprocmask(SIG_BLOCK, &block, NULL) < 0) {
+ if (sigprocmask(SIG_BLOCK, &block, NULL) == -1) {
syslog(LOG_WARNING, "siglock failed (%m)");
}
}
@@ -751,7 +751,7 @@ sigunlock(void)
sigemptyset(&block);
sigaddset(&block, SIGCHLD);
- if (sigprocmask(SIG_UNBLOCK, &block, NULL) < 0) {
+ if (sigprocmask(SIG_UNBLOCK, &block, NULL) == -1) {
syslog(LOG_WARNING, "sigunlock failed (%m)");
}
}
diff --git a/usr.sbin/rpki-client/io.c b/usr.sbin/rpki-client/io.c
index 20a88e499a5..766565ac7ad 100644
--- a/usr.sbin/rpki-client/io.c
+++ b/usr.sbin/rpki-client/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.3 2019/06/19 16:30:37 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.4 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -62,7 +62,7 @@ io_simple_write(int fd, const void *res, size_t sz)
if (sz == 0)
return;
- if ((ssz = write(fd, res, sz)) < 0)
+ if ((ssz = write(fd, res, sz)) == -1)
err(EXIT_FAILURE, "write");
else if ((size_t)ssz != sz)
errx(EXIT_FAILURE, "write: short write");
@@ -145,7 +145,7 @@ io_simple_read(int fd, void *res, size_t sz)
again:
if (sz == 0)
return;
- if ((ssz = read(fd, res, sz)) < 0)
+ if ((ssz = read(fd, res, sz)) == -1)
err(EXIT_FAILURE, "read");
else if (ssz == 0)
errx(EXIT_FAILURE, "read: unexpected end of file");
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index e4b086bc86c..37867111b98 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.10 2019/06/19 16:39:02 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.11 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -628,7 +628,7 @@ proc_rsync(const char *prog, int fd, int noop)
* That will mean that we can safely exit.
*/
- if ((ssz = read(fd, &id, sizeof(size_t))) < 0)
+ if ((ssz = read(fd, &id, sizeof(size_t))) == -1)
err(EXIT_FAILURE, "read");
if (ssz == 0)
break;
@@ -1034,7 +1034,7 @@ proc_parser(int fd, int force, int norev)
if (bsz) {
assert(bpos < bmax);
- if ((ssz = write(fd, b + bpos, bsz)) < 0)
+ if ((ssz = write(fd, b + bpos, bsz)) == -1)
err(EXIT_FAILURE, "write");
bpos += ssz;
bsz -= ssz;
diff --git a/usr.sbin/sasyncd/conf.y b/usr.sbin/sasyncd/conf.y
index 0b6731c19b5..b5970a68807 100644
--- a/usr.sbin/sasyncd/conf.y
+++ b/usr.sbin/sasyncd/conf.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.y,v 1.20 2019/03/21 10:55:41 otto Exp $ */
+/* $OpenBSD: conf.y,v 1.21 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2005 Håkan Olsson. All rights reserved.
@@ -370,7 +370,7 @@ conf_parse_file(char *cfgfile)
}
fd = open(cfgfile, O_RDONLY, 0);
- if (fd < 0)
+ if (fd == -1)
goto bad;
conflen = st.st_size;
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c
index dea969afc16..99cd09cd398 100644
--- a/usr.sbin/sensorsd/sensorsd.c
+++ b/usr.sbin/sensorsd/sensorsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensorsd.c,v 1.65 2019/05/31 15:55:50 schwarze Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.66 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -606,7 +606,7 @@ report_sdlim(struct sdlim_t *sdlim, time_t last_report)
cmd[i]);
break;
}
- if (r < 0 || (r >= len - n)) {
+ if (r == -1 || (r >= len - n)) {
syslog(LOG_CRIT, "could not parse "
"command");
return;
diff --git a/usr.sbin/smtpd/crypto.c b/usr.sbin/smtpd/crypto.c
index 39576f71a80..b6a7547cf11 100644
--- a/usr.sbin/smtpd/crypto.c
+++ b/usr.sbin/smtpd/crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto.c,v 1.7 2019/05/24 18:01:52 gilles Exp $ */
+/* $OpenBSD: crypto.c,v 1.8 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2013 Gilles Chehade <gilles@openbsd.org>
@@ -74,7 +74,7 @@ crypto_encrypt_file(FILE * in, FILE * out)
struct stat sb;
/* XXX - Do NOT encrypt files bigger than 64GB */
- if (fstat(fileno(in), &sb) < 0)
+ if (fstat(fileno(in), &sb) == -1)
return 0;
if (sb.st_size >= 0x1000000000LL)
return 0;
@@ -140,7 +140,7 @@ crypto_decrypt_file(FILE * in, FILE * out)
struct stat sb;
/* input file too small to be an encrypted file */
- if (fstat(fileno(in), &sb) < 0)
+ if (fstat(fileno(in), &sb) == -1)
return 0;
if (sb.st_size <= (off_t) (sizeof version + sizeof tag + sizeof iv))
return 0;
diff --git a/usr.sbin/smtpd/mail.maildir.c b/usr.sbin/smtpd/mail.maildir.c
index e1796e0eb04..cc9d5429aa1 100644
--- a/usr.sbin/smtpd/mail.maildir.c
+++ b/usr.sbin/smtpd/mail.maildir.c
@@ -93,7 +93,7 @@ maildir_mkdirs(const char *dirname)
char pathname[PATH_MAX];
char *subdirs[] = { "cur", "tmp", "new" };
- if (mkdirs(dirname, 0700) < 0 && errno != EEXIST)
+ if (mkdirs(dirname, 0700) == -1 && errno != EEXIST)
err(1, NULL);
for (i = 0; i < nitems(subdirs); ++i) {
@@ -101,7 +101,7 @@ maildir_mkdirs(const char *dirname)
subdirs[i]);
if (ret == -1 || (size_t)ret >= sizeof pathname)
errc(1, ENAMETOOLONG, "%s/%s", dirname, subdirs[i]);
- if (mkdir(pathname, 0700) < 0 && errno != EEXIST)
+ if (mkdir(pathname, 0700) == -1 && errno != EEXIST)
err(1, NULL);
}
}
@@ -177,7 +177,7 @@ maildir_engine(const char *dirname, int junk)
(void)snprintf(tmp, sizeof tmp, "%s/tmp/%s", dirname, filename);
fd = open(tmp, O_CREAT | O_EXCL | O_WRONLY, 0600);
- if (fd < 0)
+ if (fd == -1)
err(1, NULL);
if ((fp = fdopen(fd, "w")) == NULL)
err(1, NULL);
@@ -198,14 +198,14 @@ maildir_engine(const char *dirname, int junk)
if (fflush(fp) == EOF ||
ferror(fp) ||
- fsync(fd) < 0 ||
+ fsync(fd) == -1 ||
fclose(fp) == EOF)
err(1, NULL);
(void)snprintf(new, sizeof new, "%s/new/%s",
is_junk ? junkpath : dirname, filename);
- if (rename(tmp, new) < 0)
+ if (rename(tmp, new) == -1)
err(1, NULL);
exit(0);
diff --git a/usr.sbin/smtpd/mail.mboxfile.c b/usr.sbin/smtpd/mail.mboxfile.c
index 6dbcc0583b4..0cc1d7429e8 100644
--- a/usr.sbin/smtpd/mail.mboxfile.c
+++ b/usr.sbin/smtpd/mail.mboxfile.c
@@ -72,7 +72,7 @@ mboxfile_engine(const char *sender, const char *filename)
time(&now);
fd = open(filename, O_CREAT | O_APPEND | O_WRONLY | O_EXLOCK, 0600);
- if (fd < 0)
+ if (fd == -1)
err(1, NULL);
if ((fp = fdopen(fd, "w")) == NULL)
@@ -93,7 +93,7 @@ mboxfile_engine(const char *sender, const char *filename)
if (fflush(fp) == EOF ||
ferror(fp) ||
- fsync(fd) < 0 ||
+ fsync(fd) == -1 ||
fclose(fp) == EOF)
err(1, NULL);
}
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index 348192fc22f..9fe558216a3 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.137 2019/01/05 10:20:21 gilles Exp $ */
+/* $OpenBSD: mda.c,v 1.138 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -521,7 +521,7 @@ mda_getlastline(int fd, char *dst, size_t dstsz)
ssize_t len;
int out = 0;
- if (lseek(fd, 0, SEEK_SET) < 0) {
+ if (lseek(fd, 0, SEEK_SET) == -1) {
log_warn("warn: mda: lseek");
close(fd);
return (-1);
diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c
index c3751901b62..5b824fd6873 100644
--- a/usr.sbin/smtpd/mproc.c
+++ b/usr.sbin/smtpd/mproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mproc.c,v 1.33 2019/05/24 14:31:30 gilles Exp $ */
+/* $OpenBSD: mproc.c,v 1.34 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@faurot.net>
@@ -48,7 +48,7 @@ mproc_fork(struct mproc *p, const char *path, char *argv[])
{
int sp[2];
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) < 0)
+ if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1)
return (-1);
io_set_nonblocking(sp[0]);
@@ -60,7 +60,7 @@ mproc_fork(struct mproc *p, const char *path, char *argv[])
if (p->pid == 0) {
/* child process */
dup2(sp[0], STDIN_FILENO);
- if (closefrom(STDERR_FILENO + 1) < 0)
+ if (closefrom(STDERR_FILENO + 1) == -1)
exit(1);
execv(path, argv);
diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c
index d07c997be04..1ae0b91f745 100644
--- a/usr.sbin/smtpd/mta_session.c
+++ b/usr.sbin/smtpd/mta_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta_session.c,v 1.118 2019/06/24 15:14:01 gilles Exp $ */
+/* $OpenBSD: mta_session.c,v 1.119 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -975,7 +975,7 @@ mta_response(struct mta_session *s, char *line)
*/
sa_len = sizeof(ss);
sa = (struct sockaddr *)&ss;
- if (getsockname(io_fileno(s->io), sa, &sa_len) < 0)
+ if (getsockname(io_fileno(s->io), sa, &sa_len) == -1)
mta_delivery_log(e, NULL, buf, delivery, line);
else
mta_delivery_log(e, sa_to_text(sa),
@@ -1373,7 +1373,7 @@ mta_flush_task(struct mta_session *s, int delivery, const char *error, size_t co
*/
sa = (struct sockaddr *)&ss;
sa_len = sizeof(ss);
- if (getsockname(io_fileno(s->io), sa, &sa_len) < 0)
+ if (getsockname(io_fileno(s->io), sa, &sa_len) == -1)
mta_delivery_log(e, NULL, relay, delivery, error);
else
mta_delivery_log(e, sa_to_text(sa),
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index 9607e29ab39..39163158874 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.252 2019/05/20 07:04:13 gilles Exp $ */
+/* $OpenBSD: parse.y,v 1.253 2019/06/28 13:32:50 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -3161,7 +3161,7 @@ is_if_in_group(const char *ifname, const char *groupname)
int s;
int ret = 0;
- if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
memset(&ifgr, 0, sizeof(ifgr));
diff --git a/usr.sbin/smtpd/queue_fs.c b/usr.sbin/smtpd/queue_fs.c
index ecbc53a8647..d1cd4800a9e 100644
--- a/usr.sbin/smtpd/queue_fs.c
+++ b/usr.sbin/smtpd/queue_fs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue_fs.c,v 1.18 2018/12/30 23:09:58 guenther Exp $ */
+/* $OpenBSD: queue_fs.c,v 1.19 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -414,7 +414,7 @@ fsqueue_check_space(void)
uint64_t used;
uint64_t total;
- if (statfs(PATH_QUEUE, &buf) < 0) {
+ if (statfs(PATH_QUEUE, &buf) == -1) {
log_warn("warn: queue-fs: statfs");
return 0;
}
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 921d9f8a6d0..3eaede011a2 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.164 2018/12/23 16:37:53 eric Exp $ */
+/* $OpenBSD: smtp.c,v 1.165 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -138,7 +138,7 @@ smtp_setup_listeners(void)
}
opt = 1;
if (setsockopt(l->fd, SOL_SOCKET, SO_REUSEADDR, &opt,
- sizeof(opt)) < 0)
+ sizeof(opt)) == -1)
fatal("smtpd: setsockopt");
if (bind(l->fd, (struct sockaddr *)&l->ss, l->ss.ss_len) == -1)
fatal("smtpd: bind");
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c
index 5c5836d0ae2..67880cb0741 100644
--- a/usr.sbin/smtpd/smtp_session.c
+++ b/usr.sbin/smtpd/smtp_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp_session.c,v 1.393 2019/06/27 13:10:48 kili Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.394 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -2912,7 +2912,7 @@ smtp_message_printf(struct smtp_tx *tx, const char *fmt, ...)
len = vfprintf(tx->ofile, fmt, ap);
va_end(ap);
- if (len < 0) {
+ if (len == -1) {
log_warn("smtp-in: session %016"PRIx64": vfprintf", tx->session->id);
tx->error = TX_ERROR_IO;
}
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 4409aa16d28..9cc4fdf77d7 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.322 2019/06/28 05:35:35 deraadt Exp $ */
+/* $OpenBSD: smtpd.c,v 1.323 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -1179,7 +1179,7 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
if (pid == 0) {
/* child process */
dup2(sp[0], STDIN_FILENO);
- if (closefrom(STDERR_FILENO + 1) < 0)
+ if (closefrom(STDERR_FILENO + 1) == -1)
exit(1);
if (procname == NULL)
@@ -1297,7 +1297,7 @@ fork_processor(const char *name, const char *command, const char *user, const ch
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, errfd) == -1)
err(1, "socketpair");
- if ((pid = fork()) < 0)
+ if ((pid = fork()) == -1)
err(1, "fork");
/* parent passes the child fd over to lka */
@@ -1329,9 +1329,9 @@ fork_processor(const char *name, const char *command, const char *user, const ch
setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid))
err(1, "fork_processor: cannot drop privileges");
- if (closefrom(STDERR_FILENO + 1) < 0)
+ if (closefrom(STDERR_FILENO + 1) == -1)
err(1, "closefrom");
- if (setsid() < 0)
+ if (setsid() == -1)
err(1, "setsid");
if (signal(SIGPIPE, SIG_DFL) == SIG_ERR ||
signal(SIGINT, SIG_DFL) == SIG_ERR ||
@@ -1421,7 +1421,7 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver)
return;
}
- if (pipe(pipefd) < 0) {
+ if (pipe(pipefd) == -1) {
(void)snprintf(ebuf, sizeof ebuf, "pipe: %s", strerror(errno));
m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1);
m_add_id(p_pony, id);
@@ -1450,7 +1450,7 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver)
unlink(sfn);
pid = fork();
- if (pid < 0) {
+ if (pid == -1) {
(void)snprintf(ebuf, sizeof ebuf, "fork: %s", strerror(errno));
m_create(p_pony, IMSG_MDA_DONE, 0, 0, -1);
m_add_id(p_pony, id);
@@ -1475,19 +1475,19 @@ forkmda(struct mproc *p, uint64_t id, struct deliver *deliver)
m_close(p);
return;
}
- if (chdir(pw_dir) < 0 && chdir("/") < 0)
+ if (chdir(pw_dir) == -1 && chdir("/") == -1)
err(1, "chdir");
if (setgroups(1, &pw_gid) ||
setresgid(pw_gid, pw_gid, pw_gid) ||
setresuid(pw_uid, pw_uid, pw_uid))
err(1, "forkmda: cannot drop privileges");
- if (dup2(pipefd[0], STDIN_FILENO) < 0 ||
- dup2(allout, STDOUT_FILENO) < 0 ||
- dup2(allout, STDERR_FILENO) < 0)
+ if (dup2(pipefd[0], STDIN_FILENO) == -1 ||
+ dup2(allout, STDOUT_FILENO) == -1 ||
+ dup2(allout, STDERR_FILENO) == -1)
err(1, "forkmda: dup2");
- if (closefrom(STDERR_FILENO + 1) < 0)
+ if (closefrom(STDERR_FILENO + 1) == -1)
err(1, "closefrom");
- if (setsid() < 0)
+ if (setsid() == -1)
err(1, "setsid");
if (signal(SIGPIPE, SIG_DFL) == SIG_ERR ||
signal(SIGINT, SIG_DFL) == SIG_ERR ||
@@ -1726,7 +1726,7 @@ parent_forward_open(char *username, char *directory, uid_t uid, gid_t gid)
return -1;
}
- if (stat(directory, &sb) < 0) {
+ if (stat(directory, &sb) == -1) {
log_warn("warn: smtpd: parent_forward_open: %s", directory);
return -1;
}
diff --git a/usr.sbin/smtpd/table_db.c b/usr.sbin/smtpd/table_db.c
index 426d0f7cf90..daa6a3f8143 100644
--- a/usr.sbin/smtpd/table_db.c
+++ b/usr.sbin/smtpd/table_db.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table_db.c,v 1.20 2018/12/27 15:04:59 eric Exp $ */
+/* $OpenBSD: table_db.c,v 1.21 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -136,7 +136,7 @@ table_db_open2(struct table *table)
>= sizeof handle->pathname)
goto error;
- if (stat(handle->pathname, &sb) < 0)
+ if (stat(handle->pathname, &sb) == -1)
goto error;
handle->mtime = sb.st_mtime;
@@ -173,7 +173,7 @@ table_db_lookup(struct table *table, enum table_service service, const char *key
size_t i;
struct stat sb;
- if (stat(handle->pathname, &sb) < 0)
+ if (stat(handle->pathname, &sb) == -1)
return -1;
/* DB has changed, close and reopen */
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index 2d9628488d6..b1d95aac0fe 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.140 2019/01/30 21:33:34 gilles Exp $ */
+/* $OpenBSD: util.c,v 1.141 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -570,7 +570,7 @@ secure_file(int fd, char *path, char *userdir, uid_t uid, int mayread)
homedir[0] = '\0';
/* Check the open file to avoid races. */
- if (fstat(fd, &st) < 0 ||
+ if (fstat(fd, &st) == -1 ||
!S_ISREG(st.st_mode) ||
st.st_uid != uid ||
(st.st_mode & (mayread ? 022 : 066)) != 0)
@@ -582,7 +582,7 @@ secure_file(int fd, char *path, char *userdir, uid_t uid, int mayread)
return 0;
(void)strlcpy(buf, cp, sizeof(buf));
- if (stat(buf, &st) < 0 ||
+ if (stat(buf, &st) == -1 ||
(st.st_uid != 0 && st.st_uid != uid) ||
(st.st_mode & 022) != 0)
return 0;
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index fb0ae33aff1..6a965a44b18 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.93 2019/05/02 14:04:10 gerhard Exp $ */
+/* $OpenBSD: mib.c,v 1.94 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Knight <joel@openbsd.org>
@@ -1916,7 +1916,7 @@ mib_pflimits(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
if (pl.index == PF_LIMIT_MAX)
return (-1);
- if (ioctl(devpf, DIOCGETLIMIT, &pl)) {
+ if (ioctl(devpf, DIOCGETLIMIT, &pl) == -1) {
log_warn("DIOCGETLIMIT");
return (-1);
}
@@ -1972,7 +1972,7 @@ mib_pftimeouts(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
if (pt.timeout == PFTM_MAX)
return (-1);
- if (ioctl(devpf, DIOCGETTIMEOUT, &pt)) {
+ if (ioctl(devpf, DIOCGETTIMEOUT, &pt) == -1) {
log_warn("DIOCGETTIMEOUT");
return (-1);
}
@@ -2383,7 +2383,7 @@ mib_pflabelnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
extern int devpf;
memset(&pr, 0, sizeof(pr));
- if (ioctl(devpf, DIOCGETRULES, &pr)) {
+ if (ioctl(devpf, DIOCGETRULES, &pr) == -1) {
log_warn("DIOCGETRULES");
return (-1);
}
@@ -2392,7 +2392,7 @@ mib_pflabelnum(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
lnr = 0;
for (nr = 0; nr < mnr; ++nr) {
pr.nr = nr;
- if (ioctl(devpf, DIOCGETRULE, &pr)) {
+ if (ioctl(devpf, DIOCGETRULE, &pr) == -1) {
log_warn("DIOCGETRULE");
return (-1);
}
@@ -2420,7 +2420,7 @@ mib_pflabels(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
idx = o->bo_id[OIDIDX_pfLabelEntry];
memset(&pr, 0, sizeof(pr));
- if (ioctl(devpf, DIOCGETRULES, &pr)) {
+ if (ioctl(devpf, DIOCGETRULES, &pr) == -1) {
log_warn("DIOCGETRULES");
return (-1);
}
@@ -2429,7 +2429,7 @@ mib_pflabels(struct oid *oid, struct ber_oid *o, struct ber_element **elm)
lnr = 0;
for (nr = 0; nr < mnr; ++nr) {
pr.nr = nr;
- if (ioctl(devpf, DIOCGETRULE, &pr)) {
+ if (ioctl(devpf, DIOCGETRULE, &pr) == -1) {
log_warn("DIOCGETRULE");
return (-1);
}
diff --git a/usr.sbin/snmpd/pf.c b/usr.sbin/snmpd/pf.c
index df4ccf7e5ff..ca610da0832 100644
--- a/usr.sbin/snmpd/pf.c
+++ b/usr.sbin/snmpd/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.10 2015/02/06 23:21:59 millert Exp $ */
+/* $OpenBSD: pf.c,v 1.11 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Knight <joel@openbsd.org>
@@ -73,7 +73,7 @@ pf_get_stats(struct pf_status *s)
extern int devpf;
memset(s, 0, sizeof(*s));
- if (ioctl(devpf, DIOCGETSTATUS, s)) {
+ if (ioctl(devpf, DIOCGETSTATUS, s) == -1) {
log_warn("DIOCGETSTATUS");
return (-1);
}
@@ -98,7 +98,7 @@ pfr_get_astats(struct pfr_table *tbl, struct pfr_astats *addr, int *size,
io.pfrio_buffer = addr;
io.pfrio_esize = sizeof(*addr);
io.pfrio_size = *size;
- if (ioctl(devpf, DIOCRGETASTATS, &io))
+ if (ioctl(devpf, DIOCRGETASTATS, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -120,7 +120,7 @@ pfr_get_tstats(struct pfr_table *filter, struct pfr_tstats *tbl, int *size,
io.pfrio_buffer = tbl;
io.pfrio_esize = sizeof(*tbl);
io.pfrio_size = *size;
- if (ioctl(devpf, DIOCRGETTSTATS, &io))
+ if (ioctl(devpf, DIOCRGETTSTATS, &io) == -1)
return (-1);
*size = io.pfrio_size;
return (0);
@@ -198,7 +198,7 @@ pfi_get_ifaces(const char *filter, struct pfi_kif *buf, int *size)
io.pfiio_buffer = buf;
io.pfiio_esize = sizeof(*buf);
io.pfiio_size = *size;
- if (ioctl(devpf, DIOCIGETIFACES, &io))
+ if (ioctl(devpf, DIOCIGETIFACES, &io) == -1)
return (-1);
*size = io.pfiio_size;
return (0);
diff --git a/usr.sbin/switchd/ofcconn.c b/usr.sbin/switchd/ofcconn.c
index 059f2f4fdd9..1f2973a9ead 100644
--- a/usr.sbin/switchd/ofcconn.c
+++ b/usr.sbin/switchd/ofcconn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofcconn.c,v 1.12 2016/10/12 19:07:42 reyk Exp $ */
+/* $OpenBSD: ofcconn.c,v 1.13 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2016 YASUOKA Masahiko <yasuoka@openbsd.org>
@@ -243,7 +243,7 @@ ofsw_on_io(int fd, short evmask, void *ctx)
if ((evmask & EV_READ) && ofsw_ofc_write_ready(os)) {
if ((msgsz = read(os->os_fd, msg, sizeof(msg))) <= 0) {
- if (msgsz < 0)
+ if (msgsz == -1)
log_warn("%s: %s read", __func__, os->os_name);
else
log_warnx("%s: %s closed", __func__,
@@ -310,7 +310,7 @@ ofsw_write(struct ofsw *os, struct ofcconn *oc0)
}
if (hdr->oh_type != OFP_T_HELLO) {
if ((sz = write(os->os_fd, msg, msglen)) != msglen) {
- if (sz < 0)
+ if (sz == -1)
log_warn("%s: %s write failed", __func__,
os->os_name);
else
diff --git a/usr.sbin/syslogd/evbuffer_tls.c b/usr.sbin/syslogd/evbuffer_tls.c
index 9a0f8daecf1..3fa75c499a2 100644
--- a/usr.sbin/syslogd/evbuffer_tls.c
+++ b/usr.sbin/syslogd/evbuffer_tls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: evbuffer_tls.c,v 1.11 2017/07/04 15:52:26 bluhm Exp $ */
+/* $OpenBSD: evbuffer_tls.c,v 1.12 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2002-2004 Niels Provos <provos@citi.umich.edu>
@@ -229,7 +229,7 @@ buffertls_handshakecb(int fd, short event, void *arg)
what |= EVBUFFER_ERROR;
break;
}
- if (res < 0)
+ if (res == -1)
goto error;
/* Handshake was successful, change to read and write callback. */
diff --git a/usr.sbin/syslogd/privsep.c b/usr.sbin/syslogd/privsep.c
index 45463dbe703..1da7f4f46bd 100644
--- a/usr.sbin/syslogd/privsep.c
+++ b/usr.sbin/syslogd/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.69 2018/08/07 18:36:49 deraadt Exp $ */
+/* $OpenBSD: privsep.c,v 1.70 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org>
@@ -110,7 +110,7 @@ priv_init(int lockfd, int nullfd, int argc, char *argv[])
errx(1, "unknown user _syslogd");
child_pid = fork();
- if (child_pid < 0)
+ if (child_pid == -1)
err(1, "fork() failed");
if (!child_pid) {
@@ -239,7 +239,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
if (sigprocmask(SIG_SETMASK, &sigmask, NULL) == -1)
err(1, "sigprocmask priv");
- if (stat(conf, &cf_info) < 0)
+ if (stat(conf, &cf_info) == -1)
err(1, "stat config file failed");
TAILQ_INIT(&lognames);
@@ -261,7 +261,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
check_tty_name(path, sizeof(path));
fd = open(path, O_WRONLY|O_NONBLOCK, 0);
send_fd(sock, fd);
- if (fd < 0)
+ if (fd == -1)
warnx("priv_open_tty failed");
else
close(fd);
@@ -287,7 +287,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
errx(1, "invalid cmd");
send_fd(sock, fd);
- if (fd < 0)
+ if (fd == -1)
warnx("priv_open_log failed");
else
close(fd);
@@ -297,7 +297,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
log_debug("[priv]: msg PRIV_OPEN_UTMP received");
fd = open(_PATH_UTMP, O_RDONLY|O_NONBLOCK, 0);
send_fd(sock, fd);
- if (fd < 0)
+ if (fd == -1)
warnx("priv_open_utmp failed");
else
close(fd);
@@ -308,7 +308,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
stat(conf, &cf_info);
fd = open(conf, O_RDONLY|O_NONBLOCK, 0);
send_fd(sock, fd);
- if (fd < 0)
+ if (fd == -1)
warnx("priv_open_config failed");
else
close(fd);
@@ -316,7 +316,7 @@ priv_exec(char *conf, int numeric, int child, int argc, char *argv[])
case PRIV_CONFIG_MODIFIED:
log_debug("[priv]: msg PRIV_CONFIG_MODIFIED received");
- if (stat(conf, &cf_stat) < 0 ||
+ if (stat(conf, &cf_stat) == -1 ||
timespeccmp(&cf_info.st_mtimespec,
&cf_stat.st_mtimespec, <) ||
cf_info.st_size != cf_stat.st_size) {
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index a398eba5ab5..cd3ce8cc63a 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslogd.c,v 1.259 2019/01/18 15:44:14 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.260 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2014-2017 Alexander Bluhm <bluhm@genua.de>
@@ -1040,7 +1040,7 @@ klog_readcb(int fd, short event, void *arg)
if (n > 0) {
linebuf[n] = '\0';
printsys(linebuf);
- } else if (n < 0 && errno != EINTR) {
+ } else if (n == -1 && errno != EINTR) {
log_warn("read klog");
event_del(ev);
}
@@ -1063,7 +1063,7 @@ udp_readcb(int fd, short event, void *arg)
cvthname((struct sockaddr *)&sa, resolve, sizeof(resolve));
log_debug("cvthname res: %s", resolve);
printline(resolve, linebuf);
- } else if (n < 0 && errno != EINTR && errno != EWOULDBLOCK)
+ } else if (n == -1 && errno != EINTR && errno != EWOULDBLOCK)
log_warn("recvfrom udp");
}
@@ -1080,7 +1080,7 @@ unix_readcb(int fd, short event, void *arg)
if (n > 0) {
linebuf[n] = '\0';
printline(LocalHostName, linebuf);
- } else if (n < 0 && errno != EINTR && errno != EWOULDBLOCK)
+ } else if (n == -1 && errno != EINTR && errno != EWOULDBLOCK)
log_warn("recvfrom unix");
}
@@ -1180,7 +1180,7 @@ acceptcb(int lfd, short event, void *arg, int usetls)
}
p->p_ctx = NULL;
if (usetls) {
- if (tls_accept_socket(server_ctx, &p->p_ctx, fd) < 0) {
+ if (tls_accept_socket(server_ctx, &p->p_ctx, fd) == -1) {
log_warnx("tls_accept_socket \"%s\": %s",
peername, tls_error(server_ctx));
bufferevent_free(p->p_bufev);
@@ -2063,7 +2063,7 @@ fprintlog(struct filed *f, int flags, char *msg)
}
retryonce = 0;
again:
- if (writev(f->f_file, iov, 6) < 0) {
+ if (writev(f->f_file, iov, 6) == -1) {
int e = errno;
/* allow to recover from file system full */
diff --git a/usr.sbin/syslogd/ttymsg.c b/usr.sbin/syslogd/ttymsg.c
index f55e95edfb7..baa6e18ebfd 100644
--- a/usr.sbin/syslogd/ttymsg.c
+++ b/usr.sbin/syslogd/ttymsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymsg.c,v 1.17 2017/10/05 16:15:24 bluhm Exp $ */
+/* $OpenBSD: ttymsg.c,v 1.18 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: ttymsg.c,v 1.3 1994/11/17 07:17:55 jtc Exp $ */
/*
@@ -112,7 +112,7 @@ ttymsg(struct iovec *iov, int iovcnt, char *utline)
* open will fail on slip lines or exclusive-use lines
* if not running as root; not an error.
*/
- if ((fd = priv_open_tty(device)) < 0) {
+ if ((fd = priv_open_tty(device)) == -1) {
if (errno != EBUSY && errno != EACCES)
log_warn("priv_open_tty device \"%s\"", device);
return;
@@ -208,7 +208,7 @@ ttycb(int fd, short event, void *arg)
goto done;
wret = write(fd, td->td_line, td->td_length);
- if (wret < 0 && errno != EINTR && errno != EWOULDBLOCK)
+ if (wret == -1 && errno != EINTR && errno != EWOULDBLOCK)
goto done;
if (wret > 0) {
td->td_length -= wret;
diff --git a/usr.sbin/tcpdump/pfctl_osfp.c b/usr.sbin/tcpdump/pfctl_osfp.c
index aaead627535..dcd39e6fe4d 100644
--- a/usr.sbin/tcpdump/pfctl_osfp.c
+++ b/usr.sbin/tcpdump/pfctl_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfctl_osfp.c,v 1.15 2018/11/08 17:19:01 brynet Exp $ */
+/* $OpenBSD: pfctl_osfp.c,v 1.16 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@openbsd.org>
@@ -263,7 +263,7 @@ pfctl_file_fingerprints(int dev, int opts, const char *fp_filename)
void
pfctl_clear_fingerprints(int dev, int opts)
{
- if (ioctl(dev, DIOCOSFPFLUSH))
+ if (ioctl(dev, DIOCOSFPFLUSH) == -1)
err(1, "DIOCOSFPFLUSH");
}
@@ -294,7 +294,7 @@ pfctl_load_fingerprints(int dev, int opts)
for (i = 0; i >= 0; i++) {
memset(&io, 0, sizeof(io));
io.fp_getnum = i;
- if (ioctl(dev, DIOCOSFPGET, &io)) {
+ if (ioctl(dev, DIOCOSFPGET, &io) == -1) {
if (errno == EBUSY)
break;
warn("DIOCOSFPGET");
@@ -622,7 +622,7 @@ add_fingerprint(int dev, int opts, struct pf_osfp_ioctl *fp)
/* Linked to the sys/net/pf_osfp.c. Call pf_osfp_add() */
if ((errno = pf_osfp_add(fp)))
#else
- if ((opts & PF_OPT_NOACTION) == 0 && ioctl(dev, DIOCOSFPADD, fp))
+ if ((opts & PF_OPT_NOACTION) == 0 && ioctl(dev, DIOCOSFPADD, fp) == -1)
#endif /* FAKE_PF_KERNEL */
{
if (errno == EEXIST) {
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index 6e708216e2a..7caa398597e 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.53 2019/03/18 00:09:22 dlg Exp $ */
+/* $OpenBSD: privsep.c,v 1.54 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -172,7 +172,7 @@ priv_init(int argc, char **argv)
sigprocmask(SIG_BLOCK, &allsigs, &oset);
child_pid = fork();
- if (child_pid < 0)
+ if (child_pid == -1)
err(1, "fork() failed");
if (child_pid) {
@@ -404,7 +404,7 @@ impl_open_dump(int fd, const char *RFileName)
} else {
file = open(RFileName, O_RDONLY, 0);
err = errno;
- if (file < 0)
+ if (file == -1)
logmsg(LOG_DEBUG, "[priv]: failed to open %s: %s",
RFileName, strerror(errno));
}
@@ -423,7 +423,7 @@ impl_open_pfosfp(int fd)
file = open(PF_OSFP_FILE, O_RDONLY, 0);
err = errno;
- if (file < 0)
+ if (file == -1)
logmsg(LOG_DEBUG, "[priv]: failed to open %s: %s",
PF_OSFP_FILE, strerror(errno));
send_fd(fd, file);
@@ -443,7 +443,7 @@ impl_open_output(int fd, const char *WFileName)
err = errno;
send_fd(fd, file);
must_write(fd, &err, sizeof(int));
- if (file < 0)
+ if (file == -1)
logmsg(LOG_DEBUG, "[priv]: failed to open %s: %s",
WFileName, strerror(err));
else
diff --git a/usr.sbin/tcpdump/privsep_pcap.c b/usr.sbin/tcpdump/privsep_pcap.c
index 3d248ed1eb7..dd761ec6f53 100644
--- a/usr.sbin/tcpdump/privsep_pcap.c
+++ b/usr.sbin/tcpdump/privsep_pcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep_pcap.c,v 1.24 2019/03/18 00:09:22 dlg Exp $ */
+/* $OpenBSD: privsep_pcap.c,v 1.25 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2004 Can Erkin Acar
@@ -79,7 +79,7 @@ setfilter(int bpfd, int sock, char *filter)
goto err;
/* if bpf descriptor is open, set the filter XXX check oflag? */
- if (bpfd >= 0 && ioctl(bpfd, BIOCSETF, &fcode)) {
+ if (bpfd >= 0 && ioctl(bpfd, BIOCSETF, &fcode) == -1) {
snprintf(hpcap.errbuf, PCAP_ERRBUF_SIZE,
"ioctl: BIOCSETF: %s", strerror(errno));
pcap_freecode(&fcode);
@@ -189,23 +189,23 @@ pcap_live(const char *device, int snaplen, int promisc, u_int dlt,
ioctl(fd, BIOCSBLEN, &v);
strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
- if (ioctl(fd, BIOCSETIF, &ifr) < 0)
+ if (ioctl(fd, BIOCSETIF, &ifr) == -1)
goto error;
- if (dlt != (u_int) -1 && ioctl(fd, BIOCSDLT, &dlt))
+ if (dlt != (u_int) -1 && ioctl(fd, BIOCSDLT, &dlt) == -1)
goto error;
if (promisc)
/* this is allowed to fail */
ioctl(fd, BIOCPROMISC, NULL);
- if (ioctl(fd, BIOCSDIRFILT, &dirfilt) < 0)
+ if (ioctl(fd, BIOCSDIRFILT, &dirfilt) == -1)
goto error;
- if (ioctl(fd, BIOCSFILDROP, &fildrop) < 0)
+ if (ioctl(fd, BIOCSFILDROP, &fildrop) == -1)
goto error;
/* lock the descriptor */
- if (ioctl(fd, BIOCLOCK, NULL) < 0)
+ if (ioctl(fd, BIOCLOCK, NULL) == -1)
goto error;
return (fd);
@@ -263,7 +263,7 @@ priv_pcap_live(const char *dev, int slen, int prom, int to_ms,
}
/* fd is locked, can only use 'safe' ioctls */
- if (ioctl(fd, BIOCVERSION, &bv) < 0) {
+ if (ioctl(fd, BIOCVERSION, &bv) == -1) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCVERSION: %s",
pcap_strerror(errno));
goto bad;
@@ -280,7 +280,7 @@ priv_pcap_live(const char *dev, int slen, int prom, int to_ms,
p->snapshot = slen;
/* Get the data link layer type. */
- if (ioctl(fd, BIOCGDLT, &v) < 0) {
+ if (ioctl(fd, BIOCGDLT, &v) == -1) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCGDLT: %s",
pcap_strerror(errno));
goto bad;
@@ -296,14 +296,14 @@ priv_pcap_live(const char *dev, int slen, int prom, int to_ms,
struct timeval to;
to.tv_sec = to_ms / 1000;
to.tv_usec = (to_ms * 1000) % 1000000;
- if (ioctl(p->fd, BIOCSRTIMEOUT, &to) < 0) {
+ if (ioctl(p->fd, BIOCSRTIMEOUT, &to) == -1) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCSRTIMEOUT: %s",
pcap_strerror(errno));
goto bad;
}
}
- if (ioctl(fd, BIOCGBLEN, &v) < 0) {
+ if (ioctl(fd, BIOCGBLEN, &v) == -1) {
snprintf(ebuf, PCAP_ERRBUF_SIZE, "BIOCGBLEN: %s",
pcap_strerror(errno));
goto bad;
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index fadb1162d61..7664d8c4b3c 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpdump.c,v 1.90 2019/05/26 22:42:42 dlg Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.91 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -188,7 +188,7 @@ pcap_list_linktypes(pcap_t *p)
if (fd < 0)
error("Invalid bpf descriptor");
- if (ioctl(fd, BIOCGDLTLIST, &dl) < 0)
+ if (ioctl(fd, BIOCGDLTLIST, &dl) == -1)
err(1, "BIOCGDLTLIST");
if (dl.bfl_len > MAXDLT)
diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c
index a344e7b9ae0..082ae5236aa 100644
--- a/usr.sbin/tcpdump/util.c
+++ b/usr.sbin/tcpdump/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.28 2019/01/26 00:53:57 procter Exp $ */
+/* $OpenBSD: util.c,v 1.29 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -266,10 +266,10 @@ read_infile(char *fname)
char *cp;
fd = open(fname, O_RDONLY);
- if (fd < 0)
+ if (fd == -1)
error("can't open %s: %s", fname, pcap_strerror(errno));
- if (fstat(fd, &buf) < 0)
+ if (fstat(fd, &buf) == -1)
error("can't stat %s: %s", fname, pcap_strerror(errno));
if (buf.st_size >= SSIZE_MAX)
diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c
index b3c708b9e3e..5dd3533a2cd 100644
--- a/usr.sbin/tftpd/tftpd.c
+++ b/usr.sbin/tftpd/tftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpd.c,v 1.41 2018/01/26 16:40:14 naddy Exp $ */
+/* $OpenBSD: tftpd.c,v 1.42 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2012 David Gwynne <dlg@uq.edu.au>
@@ -744,7 +744,7 @@ tftpd_recv(int fd, short events, void *arg)
&on, sizeof(on));
if (bind(client->sock, (struct sockaddr *)&s_in,
- s_in.ss_len) < 0) {
+ s_in.ss_len) == -1) {
lwarn("bind to %s", getip(&s_in));
goto err;
}
@@ -1004,7 +1004,7 @@ retryread:
* set.
*/
wmode = O_TRUNC;
- if (stat(filename, &stbuf) < 0) {
+ if (stat(filename, &stbuf) == -1) {
if (!cancreate) {
/*
* In -i mode, retry failed read requests from
@@ -1043,12 +1043,12 @@ retryread:
}
}
fd = open(filename, mode == RRQ ? O_RDONLY : (O_WRONLY|wmode), 0666);
- if (fd < 0)
+ if (fd == -1)
return (errno + 100);
/*
* If the file was created, set default permissions.
*/
- if ((wmode & O_CREAT) && fchmod(fd, 0666) < 0) {
+ if ((wmode & O_CREAT) && fchmod(fd, 0666) == -1) {
int serrno = errno;
close(fd);
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index c88ae555434..b120620528f 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute.c,v 1.160 2019/03/19 23:27:50 tedu Exp $ */
+/* $OpenBSD: traceroute.c,v 1.161 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
@@ -347,14 +347,14 @@ main(int argc, char *argv[])
conf->waittime = 5 * 1000;
- if ((rcvsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
+ if ((rcvsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1)
v6sock_errno = errno;
- else if ((sndsock6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ else if ((sndsock6 = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
v6sock_errno = errno;
- if ((rcvsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0)
+ if ((rcvsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) == -1)
v4sock_errno = errno;
- else if ((sndsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) < 0)
+ else if ((sndsock4 = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) == -1)
v4sock_errno = errno;
/* revoke privs */
@@ -400,12 +400,12 @@ main(int argc, char *argv[])
mib[3] = IPV6CTL_DEFHLIM;
/* specify to tell receiving interface */
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
err(1, "setsockopt(IPV6_RECVPKTINFO)");
/* specify to tell hoplimit field of received IP6 hdr */
if (setsockopt(rcvsock, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &on,
- sizeof(on)) < 0)
+ sizeof(on)) == -1)
err(1, "setsockopt(IPV6_RECVHOPLIMIT)");
}
@@ -687,7 +687,7 @@ main(int argc, char *argv[])
ip->ip_tos = conf->tos;
if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL,
- &on, sizeof(on)) < 0)
+ &on, sizeof(on)) == -1)
err(6, "IP_HDRINCL");
if (conf->source) {
@@ -703,7 +703,7 @@ main(int argc, char *argv[])
errx(1, "source is on 127/8, destination is"
" not");
if (ouid && bind(sndsock, (struct sockaddr *)&from4,
- sizeof(from4)) < 0)
+ sizeof(from4)) == -1)
err(1, "bind");
}
packetlen = datalen;
@@ -787,35 +787,34 @@ main(int argc, char *argv[])
nxt = to6;
nxt.sin6_port = htons(DUMMY_PORT);
- if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ if ((dummy = socket(AF_INET6, SOCK_DGRAM, 0)) == -1)
err(1, "socket");
if (conf->rtableid > 0 &&
setsockopt(dummy, SOL_SOCKET, SO_RTABLE,
- &conf->rtableid, sizeof(conf->rtableid)) < 0)
+ &conf->rtableid, sizeof(conf->rtableid)) == -1)
err(1, "setsockopt(SO_RTABLE)");
if (connect(dummy, (struct sockaddr *)&nxt,
- nxt.sin6_len) < 0)
+ nxt.sin6_len) == -1)
err(1, "connect");
len = sizeof(from6);
if (getsockname(dummy, (struct sockaddr *)&from6,
- &len) < 0)
+ &len) == -1)
err(1, "getsockname");
close(dummy);
}
from6.sin6_port = htons(0);
- if (bind(sndsock, (struct sockaddr *)&from6, from6.sin6_len) <
- 0)
+ if (bind(sndsock, (struct sockaddr *)&from6, from6.sin6_len) == -1)
err(1, "bind sndsock");
if (conf->tflag) {
if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_TCLASS,
- &conf->tos, sizeof(conf->tos)) < 0)
+ &conf->tos, sizeof(conf->tos)) == -1)
err(6, "IPV6_TCLASS");
}
len = sizeof(from6);
- if (getsockname(sndsock, (struct sockaddr *)&from6, &len) < 0)
+ if (getsockname(sndsock, (struct sockaddr *)&from6, &len) == -1)
err(1, "getsockname");
srcport = ntohs(from6.sin6_port);
break;
@@ -832,7 +831,7 @@ main(int argc, char *argv[])
}
if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF,
- &datalen, sizeof(datalen)) < 0)
+ &datalen, sizeof(datalen)) == -1)
err(6, "SO_SNDBUF");
if (conf->nflag && !conf->Aflag) {
diff --git a/usr.sbin/traceroute/worker.c b/usr.sbin/traceroute/worker.c
index 92979359c21..e56bf59dff1 100644
--- a/usr.sbin/traceroute/worker.c
+++ b/usr.sbin/traceroute/worker.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worker.c,v 1.5 2017/08/03 17:36:06 florian Exp $ */
+/* $OpenBSD: worker.c,v 1.6 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
@@ -324,7 +324,7 @@ build_probe6(struct tr_conf *conf, int seq, u_int8_t hops, int iflag,
i = hops;
if (setsockopt(sndsock, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
- (char *)&i, sizeof(i)) < 0)
+ (char *)&i, sizeof(i)) == -1)
warn("setsockopt IPV6_UNICAST_HOPS");
if (iflag)
@@ -373,8 +373,8 @@ send_probe(struct tr_conf *conf, int seq, u_int8_t ttl, int iflag,
dump_packet();
i = sendto(sndsock, outpacket, datalen, 0, to, to->sa_len);
- if (i < 0 || i != datalen) {
- if (i < 0)
+ if (i == -1 || i != datalen) {
+ if (i == -1)
warn("sendto");
printf("%s: wrote %s %d chars, ret=%d\n", __progname, hostname,
datalen, i);
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index 2b352823a98..2e39803df59 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.125 2019/06/28 05:35:35 deraadt Exp $ */
+/* $OpenBSD: user.c,v 1.126 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
@@ -249,7 +249,7 @@ removehomedir(const char *user, uid_t uid, const char *dir)
}
/* directory exists (and is a directory!) */
- if (stat(dir, &st) < 0) {
+ if (stat(dir, &st) == -1) {
warnx("Home directory `%s' doesn't exist", dir);
return 0;
}
@@ -269,7 +269,7 @@ removehomedir(const char *user, uid_t uid, const char *dir)
/* we add the "|| true" to keep asystem() quiet if there is a non-zero exit status. */
(void) asystem("%s -rf %s > /dev/null 2>&1 || true", RM, dir);
(void) seteuid(0);
- if (rmdir(dir) < 0) {
+ if (rmdir(dir) == -1) {
warnx("Unable to remove all files in `%s'", dir);
return 0;
}
@@ -357,7 +357,7 @@ creategid(char *group, gid_t gid, const char *name)
_PATH_GROUP);
return 0;
}
- if (flock(fileno(from), LOCK_EX | LOCK_NB) < 0) {
+ if (flock(fileno(from), LOCK_EX | LOCK_NB) == -1) {
warn("can't lock `%s'", _PATH_GROUP);
}
(void) fstat(fileno(from), &st);
@@ -398,7 +398,7 @@ creategid(char *group, gid_t gid, const char *name)
unlink(f);
return 0;
}
- if (rename(f, _PATH_GROUP) < 0) {
+ if (rename(f, _PATH_GROUP) == -1) {
warn("can't create gid: can't rename `%s' to `%s'", f,
_PATH_GROUP);
unlink(f);
@@ -429,7 +429,7 @@ modify_gid(char *group, char *newent)
_PATH_GROUP);
return 0;
}
- if (flock(fileno(from), LOCK_EX | LOCK_NB) < 0) {
+ if (flock(fileno(from), LOCK_EX | LOCK_NB) == -1) {
warn("can't lock `%s'", _PATH_GROUP);
}
(void) fstat(fileno(from), &st);
@@ -497,7 +497,7 @@ modify_gid(char *group, char *newent)
unlink(f);
return 0;
}
- if (rename(f, _PATH_GROUP) < 0) {
+ if (rename(f, _PATH_GROUP) == -1) {
warn("can't modify gid: can't rename `%s' to `%s'", f, _PATH_GROUP);
unlink(f);
return 0;
@@ -554,7 +554,7 @@ append_group(char *user, int ngroups, const char **groups)
_PATH_GROUP);
return 0;
}
- if (flock(fileno(from), LOCK_EX | LOCK_NB) < 0) {
+ if (flock(fileno(from), LOCK_EX | LOCK_NB) == -1) {
warn("can't lock `%s'", _PATH_GROUP);
}
(void) fstat(fileno(from), &st);
@@ -624,7 +624,7 @@ append_group(char *user, int ngroups, const char **groups)
unlink(f);
return 0;
}
- if (rename(f, _PATH_GROUP) < 0) {
+ if (rename(f, _PATH_GROUP) == -1) {
warn("can't append group: can't rename `%s' to `%s'", f, _PATH_GROUP);
unlink(f);
return 0;
@@ -801,7 +801,7 @@ read_defaults(user_t *up)
up->u_inactive = DEF_INACTIVE;
up->u_expire = DEF_EXPIRE;
if ((fp = fopen(CONFFILE, "r")) == NULL) {
- if (stat(CONFFILE, &st) < 0 && !setdefaults(up)) {
+ if (stat(CONFFILE, &st) == -1 && !setdefaults(up)) {
warn("can't create `%s' defaults file", CONFFILE);
}
fp = fopen(CONFFILE, "r");
@@ -1001,14 +1001,14 @@ adduser(char *login_name, user_t *up)
if (!valid_class(up->u_class)) {
errx(EXIT_FAILURE, "No such login class `%s'", up->u_class);
}
- if ((masterfd = open(_PATH_MASTERPASSWD, O_RDONLY)) < 0) {
+ if ((masterfd = open(_PATH_MASTERPASSWD, O_RDONLY)) == -1) {
err(EXIT_FAILURE, "can't open `%s'", _PATH_MASTERPASSWD);
}
- if (flock(masterfd, LOCK_EX | LOCK_NB) < 0) {
+ if (flock(masterfd, LOCK_EX | LOCK_NB) == -1) {
err(EXIT_FAILURE, "can't lock `%s'", _PATH_MASTERPASSWD);
}
pw_init();
- if ((ptmpfd = pw_lock(WAITSECS)) < 0) {
+ if ((ptmpfd = pw_lock(WAITSECS)) == -1) {
int saved_errno = errno;
close(masterfd);
errc(EXIT_FAILURE, saved_errno, "can't obtain pw_lock");
@@ -1132,7 +1132,7 @@ adduser(char *login_name, user_t *up)
warnx("Warning: expire time `%s' invalid, account expiry off",
up->u_expire);
}
- if (lstat(home, &st) < 0 && !(up->u_flags & F_MKDIR) &&
+ if (lstat(home, &st) == -1 && !(up->u_flags & F_MKDIR) &&
strcmp(home, _PATH_NONEXISTENT) != 0) {
warnx("Warning: home directory `%s' doesn't exist, and -m was"
" not specified", home);
@@ -1232,7 +1232,7 @@ adduser(char *login_name, user_t *up)
}
fclose(fp);
close(ptmpfd);
- if (pw_mkdb(yp ? NULL : login_name, 0) < 0) {
+ if (pw_mkdb(yp ? NULL : login_name, 0) == -1) {
pw_abort();
err(EXIT_FAILURE, "pw_mkdb failed");
}
@@ -1261,7 +1261,7 @@ rm_user_from_groups(char *login_name)
login_name, _PATH_GROUP);
return 0;
}
- if (flock(fileno(from), LOCK_EX | LOCK_NB) < 0) {
+ if (flock(fileno(from), LOCK_EX | LOCK_NB) == -1) {
warn("can't lock `%s'", _PATH_GROUP);
}
(void) fstat(fileno(from), &st);
@@ -1331,7 +1331,7 @@ rm_user_from_groups(char *login_name)
unlink(f);
return 0;
}
- if (rename(f, _PATH_GROUP) < 0) {
+ if (rename(f, _PATH_GROUP) == -1) {
warn("can't remove gid for `%s': can't rename `%s' to `%s'",
login_name, f, _PATH_GROUP);
unlink(f);
@@ -1435,14 +1435,14 @@ moduser(char *login_name, char *newlogin, user_t *up)
/* get the last char of the shell in case we need it for '-U' or '-Z' */
shell_last_char = pwp->pw_shell+strlen(pwp->pw_shell) - 1;
- if ((masterfd = open(_PATH_MASTERPASSWD, O_RDONLY)) < 0) {
+ if ((masterfd = open(_PATH_MASTERPASSWD, O_RDONLY)) == -1) {
err(EXIT_FAILURE, "can't open `%s'", _PATH_MASTERPASSWD);
}
- if (flock(masterfd, LOCK_EX | LOCK_NB) < 0) {
+ if (flock(masterfd, LOCK_EX | LOCK_NB) == -1) {
err(EXIT_FAILURE, "can't lock `%s'", _PATH_MASTERPASSWD);
}
pw_init();
- if ((ptmpfd = pw_lock(WAITSECS)) < 0) {
+ if ((ptmpfd = pw_lock(WAITSECS)) == -1) {
int saved_errno = errno;
close(masterfd);
errc(EXIT_FAILURE, saved_errno, "can't obtain pw_lock");
diff --git a/usr.sbin/vipw/vipw.c b/usr.sbin/vipw/vipw.c
index 83ba0c117c9..685a437b73a 100644
--- a/usr.sbin/vipw/vipw.c
+++ b/usr.sbin/vipw/vipw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vipw.c,v 1.23 2019/03/25 15:45:18 robert Exp $ */
+/* $OpenBSD: vipw.c,v 1.24 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -76,10 +76,10 @@ main(int argc, char *argv[])
pw_init();
tfd = pw_lock(0);
- if (tfd < 0)
+ if (tfd == -1)
errx(1, "the passwd file is busy or you cannot lock.");
pfd = open(_PATH_MASTERPASSWD, O_RDONLY, 0);
- if (pfd < 0)
+ if (pfd == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
copyfile(pfd, tfd, &begin);
(void)close(tfd);
@@ -112,9 +112,9 @@ copyfile(int from, int to, struct stat *sb)
pw_error(_PATH_MASTERPASSWD, 1, 1);
while ((nr = read(from, buf, sizeof(buf))) > 0)
for (off = 0; nr > 0; nr -= nw, off += nw)
- if ((nw = write(to, buf + off, nr)) < 0)
+ if ((nw = write(to, buf + off, nr)) == -1)
pw_error(_PATH_MASTERPASSWD_LOCK, 1, 1);
- if (nr < 0)
+ if (nr == -1)
pw_error(_PATH_MASTERPASSWD, 1, 1);
ts[0] = sb->st_atim;
diff --git a/usr.sbin/vmd/priv.c b/usr.sbin/vmd/priv.c
index 54db0b66b63..6ced20244ea 100644
--- a/usr.sbin/vmd/priv.c
+++ b/usr.sbin/vmd/priv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: priv.c,v 1.14 2018/11/21 12:31:47 reyk Exp $ */
+/* $OpenBSD: priv.c,v 1.15 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2016 Reyk Floeter <reyk@openbsd.org>
@@ -124,13 +124,13 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
/* Set the interface description */
strlcpy(ifr.ifr_name, vfr.vfr_name, sizeof(ifr.ifr_name));
ifr.ifr_data = (caddr_t)vfr.vfr_value;
- if (ioctl(env->vmd_fd, SIOCSIFDESCR, &ifr) < 0)
+ if (ioctl(env->vmd_fd, SIOCSIFDESCR, &ifr) == -1)
log_warn("SIOCSIFDESCR");
break;
case IMSG_VMDOP_PRIV_IFRDOMAIN:
strlcpy(ifr.ifr_name, vfr.vfr_name, sizeof(ifr.ifr_name));
ifr.ifr_rdomainid = vfr.vfr_id;
- if (ioctl(env->vmd_fd, SIOCSIFRDOMAIN, &ifr) < 0)
+ if (ioctl(env->vmd_fd, SIOCSIFRDOMAIN, &ifr) == -1)
log_warn("SIOCSIFRDOMAIN");
break;
case IMSG_VMDOP_PRIV_IFADD:
@@ -143,14 +143,14 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
sizeof(ifbr.ifbr_name));
strlcpy(ifbr.ifbr_ifsname, vfr.vfr_value,
sizeof(ifbr.ifbr_ifsname));
- if (ioctl(env->vmd_fd, SIOCBRDGADD, &ifbr) < 0 &&
+ if (ioctl(env->vmd_fd, SIOCBRDGADD, &ifbr) == -1 &&
errno != EEXIST)
log_warn("SIOCBRDGADD");
break;
case IMSG_VMDOP_PRIV_IFEXISTS:
/* Determine if bridge/switch exists */
strlcpy(ifr.ifr_name, vfr.vfr_name, sizeof(ifr.ifr_name));
- if (ioctl(env->vmd_fd, SIOCGIFFLAGS, &ifr) < 0)
+ if (ioctl(env->vmd_fd, SIOCGIFFLAGS, &ifr) == -1)
fatalx("%s: bridge \"%s\" does not exist",
__func__, vfr.vfr_name);
break;
@@ -158,7 +158,7 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
case IMSG_VMDOP_PRIV_IFDOWN:
/* Set the interface status */
strlcpy(ifr.ifr_name, vfr.vfr_name, sizeof(ifr.ifr_name));
- if (ioctl(env->vmd_fd, SIOCGIFFLAGS, &ifr) < 0) {
+ if (ioctl(env->vmd_fd, SIOCGIFFLAGS, &ifr) == -1) {
log_warn("SIOCGIFFLAGS");
break;
}
@@ -166,7 +166,7 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
ifr.ifr_flags |= IFF_UP;
else
ifr.ifr_flags &= ~IFF_UP;
- if (ioctl(env->vmd_fd, SIOCSIFFLAGS, &ifr) < 0)
+ if (ioctl(env->vmd_fd, SIOCSIFFLAGS, &ifr) == -1)
log_warn("SIOCSIFFLAGS");
break;
case IMSG_VMDOP_PRIV_IFGROUP:
@@ -179,7 +179,7 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
sizeof(ifgr.ifgr_group)) >= sizeof(ifgr.ifgr_group))
fatalx("%s: group name too long", __func__);
- if (ioctl(env->vmd_fd, SIOCAIFGROUP, &ifgr) < 0 &&
+ if (ioctl(env->vmd_fd, SIOCAIFGROUP, &ifgr) == -1 &&
errno != EEXIST)
log_warn("SIOCAIFGROUP");
break;
@@ -202,7 +202,7 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
memcpy(&ifra.ifra_mask, &vfr.vfr_mask,
ifra.ifra_mask.sa_len);
- if (ioctl(env->vmd_fd, SIOCAIFADDR, &ifra) < 0)
+ if (ioctl(env->vmd_fd, SIOCAIFADDR, &ifra) == -1)
log_warn("SIOCAIFADDR");
break;
case IMSG_VMDOP_PRIV_IFADDR6:
@@ -217,7 +217,7 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
strlcpy(ifar.ifar_name, vfr.vfr_name,
sizeof(ifar.ifar_name));
ifar.ifar_af = AF_INET6;
- if (ioctl(env->vmd_fd, SIOCIFAFATTACH, (caddr_t)&ifar) < 0)
+ if (ioctl(env->vmd_fd, SIOCIFAFATTACH, (caddr_t)&ifar) == -1)
log_warn("SIOCIFAFATTACH");
/* Set the interface address */
@@ -237,11 +237,11 @@ priv_dispatch_parent(int fd, struct privsep_proc *p, struct imsg *imsg)
in6_ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
in6_ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
- if (ioctl(env->vmd_fd6, SIOCDIFADDR_IN6, &in6_ifra) < 0 &&
+ if (ioctl(env->vmd_fd6, SIOCDIFADDR_IN6, &in6_ifra) == -1 &&
errno != EADDRNOTAVAIL)
log_warn("SIOCDIFADDR_IN6");
- if (ioctl(env->vmd_fd6, SIOCAIFADDR_IN6, &in6_ifra) < 0)
+ if (ioctl(env->vmd_fd6, SIOCAIFADDR_IN6, &in6_ifra) == -1)
log_warn("SIOCAIFADDR_IN6");
break;
case IMSG_VMDOP_CONFIG:
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index 72b2e379ac3..16683af31cb 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.49 2019/05/28 03:20:59 pd Exp $ */
+/* $OpenBSD: vm.c,v 1.50 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -571,7 +571,7 @@ send_vm(int fd, struct vm_create_params *vcp)
goto err;
vtp.vtp_vm_id = vcp->vcp_id;
- if (ioctl(env->vmd_fd, VMM_IOC_TERM, &vtp) < 0) {
+ if (ioctl(env->vmd_fd, VMM_IOC_TERM, &vtp) == -1) {
log_warnx("%s: term IOC error: %d, %d", __func__,
errno, ENOENT);
}
@@ -746,7 +746,7 @@ vcpu_reset(uint32_t vmid, uint32_t vcpu_id, struct vcpu_reg_state *vrs)
log_debug("%s: resetting vcpu %d for vm %d", __func__, vcpu_id, vmid);
- if (ioctl(env->vmd_fd, VMM_IOC_RESETCPU, &vrp) < 0)
+ if (ioctl(env->vmd_fd, VMM_IOC_RESETCPU, &vrp) == -1)
return (errno);
return (0);
@@ -897,7 +897,7 @@ vmm_create_vm(struct vm_create_params *vcp)
if (vcp->vcp_nnics > VMM_MAX_NICS_PER_VM)
return (EINVAL);
- if (ioctl(env->vmd_fd, VMM_IOC_CREATE, vcp) < 0)
+ if (ioctl(env->vmd_fd, VMM_IOC_CREATE, vcp) == -1)
return (errno);
return (0);
@@ -1157,7 +1157,7 @@ run_vm(int child_cdrom, int child_disks[][VM_MAX_BASE_PER_DISK],
vregsp.vrwp_regs = *vrs;
vregsp.vrwp_mask = VM_RWREGS_ALL;
if ((ret = ioctl(env->vmd_fd, VMM_IOC_WRITEREGS,
- &vregsp)) < 0) {
+ &vregsp)) == -1) {
log_warn("%s: writeregs failed", __func__);
return (ret);
}
@@ -1355,7 +1355,7 @@ vcpu_run_loop(void *arg)
}
}
- if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) < 0) {
+ if (ioctl(env->vmd_fd, VMM_IOC_RUN, vrp) == -1) {
/* If run ioctl failed, exit */
ret = errno;
log_warn("%s: vm %d / vcpu %d run ioctl failed",
@@ -1399,7 +1399,7 @@ vcpu_pic_intr(uint32_t vm_id, uint32_t vcpu_id, uint8_t intr)
vip.vip_vcpu_id = vcpu_id; /* XXX always 0? */
vip.vip_intr = intr;
- if (ioctl(env->vmd_fd, VMM_IOC_INTR, &vip) < 0)
+ if (ioctl(env->vmd_fd, VMM_IOC_INTR, &vip) == -1)
return (errno);
return (0);
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 01eeba77f27..23c34dd6dd1 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.113 2019/05/20 17:04:24 jasper Exp $ */
+/* $OpenBSD: vmd.c,v 1.114 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1736,7 +1736,7 @@ vm_opentty(struct vmd_vm *vm)
* We use user ioctl(2) mode to pass break commands.
*/
on = 1;
- if (ioctl(ptm.cfd, TIOCUCNTL, &on))
+ if (ioctl(ptm.cfd, TIOCUCNTL, &on) == -1)
fatal("could not enable user ioctl mode");
vm->vm_tty = ptm.cfd;
diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c
index 1cb70b6989a..ab01e2589ce 100644
--- a/usr.sbin/vmd/vmm.c
+++ b/usr.sbin/vmd/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.92 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: vmm.c,v 1.93 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -769,7 +769,7 @@ get_info_vm(struct privsep *ps, struct imsg *imsg, int terminate)
memset(&vir, 0, sizeof(vir));
/* First ioctl to see how many bytes needed (vip.vip_size) */
- if (ioctl(env->vmd_fd, VMM_IOC_INFO, &vip) < 0)
+ if (ioctl(env->vmd_fd, VMM_IOC_INFO, &vip) == -1)
return (errno);
if (vip.vip_info_ct != 0)
@@ -781,7 +781,7 @@ get_info_vm(struct privsep *ps, struct imsg *imsg, int terminate)
/* Second ioctl to get the actual list */
vip.vip_info = info;
- if (ioctl(env->vmd_fd, VMM_IOC_INFO, &vip) < 0) {
+ if (ioctl(env->vmd_fd, VMM_IOC_INFO, &vip) == -1) {
ret = errno;
free(info);
return (ret);
diff --git a/usr.sbin/wsfontload/wsfontload.c b/usr.sbin/wsfontload/wsfontload.c
index 97f2242220e..1cdc1bf50af 100644
--- a/usr.sbin/wsfontload/wsfontload.c
+++ b/usr.sbin/wsfontload/wsfontload.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsfontload.c,v 1.20 2017/08/23 09:15:33 fcambus Exp $ */
+/* $OpenBSD: wsfontload.c,v 1.21 2019/06/28 13:32:51 deraadt Exp $ */
/* $NetBSD: wsfontload.c,v 1.2 2000/01/05 18:46:43 ad Exp $ */
/*
@@ -136,7 +136,7 @@ main(int argc, char *argv[])
usage();
wsfd = open(wsdev, O_RDWR, 0);
- if (wsfd < 0)
+ if (wsfd == -1)
err(2, "open %s", wsdev);
if (list) {
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
if (argc > 0) {
infile = argv[0];
ffd = open(infile, O_RDONLY, 0);
- if (ffd < 0)
+ if (ffd == -1)
err(4, "open %s", infile);
if (!*f.name)
strlcpy(f.name, infile, WSFONT_NAME_SIZE);
@@ -229,7 +229,7 @@ main(int argc, char *argv[])
if (!buf)
errx(1, "malloc");
res = read(ffd, buf, len);
- if (res < 0)
+ if (res == -1)
err(4, "read %s", infile);
if (res != len)
errx(4, "short read on %s", infile);
@@ -237,7 +237,7 @@ main(int argc, char *argv[])
f.data = buf;
res = ioctl(wsfd, WSDISPLAYIO_LDFONT, &f);
- if (res < 0)
+ if (res == -1)
err(3, "WSDISPLAYIO_LDFONT");
return (0);
diff --git a/usr.sbin/wsmoused/mouse_protocols.c b/usr.sbin/wsmoused/mouse_protocols.c
index 2caf4b10a14..81ab3f713be 100644
--- a/usr.sbin/wsmoused/mouse_protocols.c
+++ b/usr.sbin/wsmoused/mouse_protocols.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mouse_protocols.c,v 1.16 2014/05/14 18:28:22 shadchin Exp $ */
+/* $OpenBSD: mouse_protocols.c,v 1.17 2019/06/28 13:32:51 deraadt Exp $ */
/*
* Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon
@@ -189,7 +189,7 @@ SetMouseSpeed(int old, unsigned int cflag)
struct termios tty;
char *c;
- if (tcgetattr(mouse.mfd, &tty) < 0) {
+ if (tcgetattr(mouse.mfd, &tty) == -1) {
debug("Warning: %s unable to get status of mouse fd (%s)\n",
mouse.portname, strerror(errno));
return;
@@ -220,7 +220,7 @@ SetMouseSpeed(int old, unsigned int cflag)
cfsetospeed(&tty, B1200);
}
- if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) < 0)
+ if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) == -1)
logerr(1, "unable to get mouse status. Exiting...\n");
c = "*n";
@@ -233,7 +233,7 @@ SetMouseSpeed(int old, unsigned int cflag)
}
usleep(100000);
- if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) < 0)
+ if (tcsetattr(mouse.mfd, TCSADRAIN, &tty) == -1)
logerr(1, "unable to get mouse status. Exiting...\n");
}
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 944daef08d2..a4ce3f62ff1 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypbind.c,v 1.72 2018/04/26 15:55:14 guenther Exp $ */
+/* $OpenBSD: ypbind.c,v 1.73 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org>
@@ -470,7 +470,7 @@ main(int argc, char *argv[])
}
}
- if ((rpcsock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0)) < 0) {
+ if ((rpcsock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0)) == -1) {
perror("socket");
return -1;
}
@@ -480,7 +480,7 @@ main(int argc, char *argv[])
sin.sin_port = 0;
bindresvport(rpcsock, &sin);
- if ((pingsock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0)) < 0) {
+ if ((pingsock = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0)) == -1) {
perror("socket");
return -1;
}
@@ -653,7 +653,7 @@ ping(struct _dom_binding *ypdb)
ypdb->dom_alive = 2;
if (sendto(pingsock, buf, outlen, 0,
(struct sockaddr *)&ypdb->dom_server_addr,
- (socklen_t)sizeof ypdb->dom_server_addr) < 0)
+ (socklen_t)sizeof ypdb->dom_server_addr) == -1)
perror("sendto");
return 0;
@@ -732,7 +732,7 @@ pings(struct _dom_binding *ypdb)
bindsin.sin_port = htons(PMAPPORT);
bindsin.sin_addr = ypdb->dom_server_addr.sin_addr;
if (sendto(rpcsock, buf, outlen, 0, (struct sockaddr *)&bindsin,
- (socklen_t)sizeof bindsin) < 0)
+ (socklen_t)sizeof bindsin) == -1)
perror("sendto");
}
if (ypdb->dom_servlistfp)
@@ -779,7 +779,7 @@ broadcast(struct _dom_binding *ypdb, char *buf, int outlen)
bindsin.sin_addr = in;
if (sendto(rpcsock, buf, outlen, 0, (struct sockaddr *)&bindsin,
- (socklen_t)bindsin.sin_len) < 0)
+ (socklen_t)bindsin.sin_len) == -1)
perror("sendto");
}
freeifaddrs(ifap);
@@ -836,7 +836,7 @@ direct(struct _dom_binding *ypdb, char *buf, int outlen)
hp->h_length);
if (sendto(rpcsock, buf, outlen, 0,
(struct sockaddr *)&bindsin,
- (socklen_t)sizeof bindsin) < 0) {
+ (socklen_t)sizeof bindsin) == -1) {
perror("sendto");
continue;
}
@@ -867,7 +867,7 @@ try_again:
fromlen = sizeof (struct sockaddr);
inlen = recvfrom(rpcsock, buf, sizeof buf, 0,
(struct sockaddr *)&raddr, &fromlen);
- if (inlen < 0) {
+ if (inlen == -1) {
if (errno == EINTR)
goto try_again;
return RPC_CANTRECV;
@@ -919,7 +919,7 @@ try_again:
fromlen = sizeof (struct sockaddr);
inlen = recvfrom(pingsock, buf, sizeof buf, 0,
(struct sockaddr *)&raddr, &fromlen);
- if (inlen < 0) {
+ if (inlen == -1) {
if (errno == EINTR)
goto try_again;
return RPC_CANTRECV;
diff --git a/usr.sbin/ypldap/ldapclient.c b/usr.sbin/ypldap/ldapclient.c
index 82b640ce19c..473986a8c5e 100644
--- a/usr.sbin/ypldap/ldapclient.c
+++ b/usr.sbin/ypldap/ldapclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldapclient.c,v 1.42 2018/11/27 12:06:39 martijn Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.43 2019/06/28 13:32:52 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
@@ -77,7 +77,7 @@ client_aldap_open(struct ypldap_addr_list *addr)
sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV))
errx(1, "could not get numeric hostname");
- if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0)
+ if ((fd = socket(sa->sa_family, SOCK_STREAM, 0)) == -1)
return NULL;
if (connect(fd, sa, SA_LEN(sa)) == 0)