diff options
author | joerg <joerg@FreeBSD.org> | 1997-08-23 15:51:14 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1997-08-23 15:51:14 +0000 |
commit | 9eee91f94a2c8e1b8a3d01497dae78e13b63afa0 (patch) | |
tree | 39e3a3addd98869373a57ac79e7d0289f8bad070 /usr.bin/brandelf | |
parent | 5124e2fb511364612caf3b5c6ffebc3666ecc727 (diff) | |
download | FreeBSD-src-9eee91f94a2c8e1b8a3d01497dae78e13b63afa0.zip FreeBSD-src-9eee91f94a2c8e1b8a3d01497dae78e13b63afa0.tar.gz |
Open the file r/o if looking only. Make the error message more useful.
PR: bin/3283
Submitted by: Martin Kammerhofer <dada@freepass.tu-graz.ac.at>
Diffstat (limited to 'usr.bin/brandelf')
-rw-r--r-- | usr.bin/brandelf/brandelf.c | 6 |
1 files changed, 3 insertions, 3 deletions
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 <elf.h> @@ -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; |