From df69c215c7c66baf660f3f65414fd34796c96152 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 28 Jun 2019 13:32:41 +0000 Subject: 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. --- distrib/special/more/more.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'distrib/special') 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 @@ -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 { -- cgit v1.2.3-59-g8ed1b