summaryrefslogtreecommitdiff
path: root/games/mille/save.c
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 /games/mille/save.c
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.
Diffstat (limited to 'games/mille/save.c')
-rw-r--r--games/mille/save.c8
1 files changed, 4 insertions, 4 deletions
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);