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/unifdef | |
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/unifdef')
-rw-r--r-- | usr.bin/unifdef/unifdef.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c index f43a95472cd..bd23579b01b 100644 --- a/usr.bin/unifdef/unifdef.c +++ b/usr.bin/unifdef/unifdef.c @@ -410,7 +410,7 @@ processinout(const char *ifn, const char *ofn) process(); return; } - if (stat(ofn, &st) < 0) { + if (stat(ofn, &st) == -1) { output = fopen(ofn, "wb"); if (output == NULL) err(2, "can't create %s", ofn); @@ -427,11 +427,11 @@ processinout(const char *ifn, const char *ofn) if (backext != NULL && *backext != '\0') { char *backname = astrcat(ofn, backext); - if (rename(ofn, backname) < 0) + if (rename(ofn, backname) == -1) err(2, "can't rename \"%s\" to \"%s\"", ofn, backname); free(backname); } - if (rename(tempname, ofn) < 0) + if (rename(tempname, ofn) == -1) err(2, "can't rename \"%s\" to \"%s\"", tempname, ofn); free(tempname); tempname = NULL; |