diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
commit | 86ffccf24f66032a89d70a32b3609584c0db7345 (patch) | |
tree | 2ae97fac6ea5be57cc953baf8612e8f683da0172 /libexec/talkd/talkd.c | |
parent | ce9fea47562d4f179d45680d6aec00ede2877141 (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.
Diffstat (limited to 'libexec/talkd/talkd.c')
-rw-r--r-- | libexec/talkd/talkd.c | 8 |
1 files changed, 4 insertions, 4 deletions
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; } |