Print this page
2940 elfdump should return non-null on invalid file type

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/elfdump/common/main.c
          +++ new/usr/src/cmd/sgs/elfdump/common/main.c
↓ open down ↓ 966 lines elided ↑ open up ↑
 967  967  
 968  968                  switch (elf_kind(elf)) {
 969  969                  case ELF_K_AR:
 970  970                          ret = archive(file, fd, elf, flags, wname, wfd, osabi);
 971  971                          break;
 972  972                  case ELF_K_ELF:
 973  973                          ret = decide(file, fd, elf, flags, wname, wfd, osabi);
 974  974                          break;
 975  975                  default:
 976  976                          (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file);
      977 +                        ret = 1;
 977  978                          break;
 978  979                  }
 979  980  
 980  981                  (void) close(fd);
 981  982                  (void) elf_end(elf);
 982  983          }
 983  984  
 984  985          if (wfd)
 985  986                  (void) close(wfd);
 986  987          return (ret);
 987  988  
 988  989  usage_brief:
 989  990          /* Control comes here for a simple usage message and exit */
 990  991          (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF),
 991  992              basename(argv[0]));
 992  993          return (1);
 993  994  
 994  995  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX