Project

General

Profile

Actions

Bug #2940

open

elfdump should return non-null on invalid file type

Added by Igor Pashev almost 11 years ago. Updated almost 11 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
-
Start date:
2012-06-27
Due date:
% Done:

90%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

# elfdump -e /tmp/nsboot/lib/svc/share/ipf_include.sh; echo $?
/tmp/nsboot/lib/svc/share/ipf_include.sh: invalid file type
0

Compare with readelf from GNU binutils:

# readelf -d /etc/fstab; echo $?
readelf: Error: Unable to read in 0xa23 bytes of section headers
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
1

Actions #1

Updated by Igor Pashev almost 11 years ago

diff -r 836bfdf31fc4 usr/src/cmd/sgs/elfdump/common/main.c
--- a/usr/src/cmd/sgs/elfdump/common/main.c     Tue Jun 05 18:33:58 2012 +0200
+++ b/usr/src/cmd/sgs/elfdump/common/main.c     Thu Jun 28 00:23:47 2012 +0100
@@ -974,6 +974,7 @@
                        break;
                default:
                        (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file);
+                       ret = 1;
                        break;
                }

Actions #3

Updated by Igor Pashev almost 11 years ago

  • Status changed from New to In Progress
  • Assignee set to Igor Pashev
  • % Done changed from 0 to 90
Actions

Also available in: Atom PDF