diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:35:06 +0000 |
commit | 61656abc7ff84215165af1bd464bc053b3b66158 (patch) | |
tree | c7eabb0c4fa9faa024e724e99c240c40da07ca42 /usr.bin/tic | |
parent | 18603ebf99fbb890ae9666cb0c4aa9f879e7edaa (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 'usr.bin/tic')
-rw-r--r-- | usr.bin/tic/tic.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/tic/tic.c b/usr.bin/tic/tic.c index b25c38419e4..4e4c606600c 100644 --- a/usr.bin/tic/tic.c +++ b/usr.bin/tic/tic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tic.c,v 1.33 2015/11/11 02:52:46 deraadt Exp $ */ +/* $OpenBSD: tic.c,v 1.34 2019/06/28 13:35:04 deraadt Exp $ */ /**************************************************************************** * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * @@ -46,7 +46,7 @@ #include <dump_entry.h> #include <transform.h> -MODULE_ID("$Id: tic.c,v 1.33 2015/11/11 02:52:46 deraadt Exp $") +MODULE_ID("$Id: tic.c,v 1.34 2019/06/28 13:35:04 deraadt Exp $") const char *_nc_progname = "tic"; @@ -369,7 +369,7 @@ open_input(const char *filename) fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename); ExitProgram(EXIT_FAILURE); } - if (fstat(fileno(fp), &sb) < 0 + if (fstat(fileno(fp), &sb) == -1 || (sb.st_mode & S_IFMT) != S_IFREG) { fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename); ExitProgram(EXIT_FAILURE); |