diff options
author | deraadt <deraadt@openbsd.org> | 2019-06-28 13:32:41 +0000 |
---|---|---|
committer | deraadt <deraadt@openbsd.org> | 2019-06-28 13:32:41 +0000 |
commit | df69c215c7c66baf660f3f65414fd34796c96152 (patch) | |
tree | 0255639162b24c4a2f761a274e32b69c2256fd45 /usr.sbin/tftpd | |
parent | miniroot prototype disklabels should attempt to contain accurate (diff) | |
download | wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.tar.xz wireguard-openbsd-df69c215c7c66baf660f3f65414fd34796c96152.zip |
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.
Diffstat (limited to 'usr.sbin/tftpd')
-rw-r--r-- | usr.sbin/tftpd/tftpd.c | 10 |
1 files changed, 5 insertions, 5 deletions
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); |