Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Apr 1997 12:32:01 +0200
From:      Martin Kammerhofer <dada@freepass.tu-graz.ac.at>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3283: brandelf fails on files without write permission
Message-ID:  <199704141032.MAA13456@freepass.tu-graz.ac.at>
Resent-Message-ID: <199704141040.DAA02559@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3283
>Category:       bin
>Synopsis:       brandelf fails on files without write permission
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 14 03:40:07 PDT 1997
>Last-Modified:
>Originator:     Martin Kammerhofer
>Organization:
Graz University of Technology
>Release:        FreeBSD 2.2.1-RELEASE i386
>Environment:
	any ELF file without write permission

>Description:
	brandelf(1) reports "No such file..." if it cannot open the
	file with mode O_RDWR.
	It therefore doesn´t report on R/O files.

>How-To-Repeat:
	chmod -w elf-file
	brandelf -v elf-file

>Fix:

--- brandelf.c	1997/04/09 01:06:11	1.3
+++ brandelf.c	1997/04/09 01:12:31	1.4
@@ -68,7 +68,7 @@
 		char buffer[EI_NINDENT];
 		char string[(EI_NINDENT-EI_SPARE)+1];
 
-		if ((fd = open(argv[0], O_RDWR, 0)) < 0) {
+		if ((fd = open(argv[0], change ? O_RDWR : O_RDONLY, 0)) < 0) {
 			fprintf(stderr, "No such file %s.\n", argv[0]);
 			retval = 1;
 			goto fail;
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704141032.MAA13456>