summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-22 13:25:59 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-22 13:25:59 +0000
commitd940652ff9076aa67eda3535062cceadcd3ec6be (patch)
tree03dfe10a3741aac13520fc02fa8b7c456f3bafd7
parent97bdd4e9589756b118af63d9bf10072b0ad71c95 (diff)
Make sure open returns fd != 1, not fd > 0.
From Alexey Dobriyan. OK otto@
-rw-r--r--usr.bin/elf2olf/elf2olf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/elf2olf/elf2olf.c b/usr.bin/elf2olf/elf2olf.c
index c0a2df47cd8..5e2d875d438 100644
--- a/usr.bin/elf2olf/elf2olf.c
+++ b/usr.bin/elf2olf/elf2olf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf2olf.c,v 1.7 2003/06/10 22:20:46 deraadt Exp $ */
+/* $OpenBSD: elf2olf.c,v 1.8 2006/03/22 13:25:58 ray Exp $ */
/*
* Copyright (c) 1996 Erik Theisen. All rights reserved.
*
@@ -30,7 +30,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "@(#) $Id: elf2olf.c,v 1.7 2003/06/10 22:20:46 deraadt Exp $";
+static char rcsid[] = "@(#) $Id: elf2olf.c,v 1.8 2006/03/22 13:25:58 ray Exp $";
#endif
#include <stdlib.h>
@@ -122,7 +122,7 @@ main(int argc, char*argv[])
do {
okay = 0;
- if ((fd = open(*argv, O_RDWR | O_EXLOCK, 0)) > 0 &&
+ if ((fd = open(*argv, O_RDWR | O_EXLOCK, 0)) != -1 &&
lseek(fd, (off_t)0, SEEK_SET) == 0 &&
fstat(fd, &st) == 0) {