From 9eee91f94a2c8e1b8a3d01497dae78e13b63afa0 Mon Sep 17 00:00:00 2001 From: joerg Date: Sat, 23 Aug 1997 15:51:14 +0000 Subject: Open the file r/o if looking only. Make the error message more useful. PR: bin/3283 Submitted by: Martin Kammerhofer --- usr.bin/brandelf/brandelf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin/brandelf') diff --git a/usr.bin/brandelf/brandelf.c b/usr.bin/brandelf/brandelf.c index 86519aa..79970e8 100644 --- a/usr.bin/brandelf/brandelf.c +++ b/usr.bin/brandelf/brandelf.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: brandelf.c,v 1.6 1997/05/21 23:07:17 jdp Exp $ + * $Id: brandelf.c,v 1.7 1997/06/23 06:47:12 charnier Exp $ */ #include @@ -67,8 +67,8 @@ main(int argc, char **argv) char buffer[EI_NIDENT]; char string[(EI_NIDENT-EI_BRAND)+1]; - if ((fd = open(argv[0], O_RDWR, 0)) < 0) { - warnx("no such file %s", argv[0]); + if ((fd = open(argv[0], change? O_RDWR: O_RDONLY, 0)) < 0) { + warn("error opening file %s", argv[0]); retval = 1; goto fail; -- cgit v1.1