[BACK]Return to nm.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / nm

Diff for /src/usr.bin/nm/nm.c between version 1.23 and 1.24

version 1.23, 2004/01/14 04:23:26 version 1.24, 2004/04/29 13:34:37
Line 247 
Line 247 
         union hdr exec_head;          union hdr exec_head;
         FILE *fp;          FILE *fp;
         int retval;          int retval;
           size_t bytes;
         char magic[SARMAG];          char magic[SARMAG];
   
         if (!(fp = fopen(fname, "r"))) {          if (!(fp = fopen(fname, "r"))) {
Line 261 
Line 262 
          * first check whether this is an object file - read a object           * first check whether this is an object file - read a object
          * header, and skip back to the beginning           * header, and skip back to the beginning
          */           */
         if (fread((char *)&exec_head, sizeof(exec_head), (size_t)1, fp) != 1) {          bzero(&exec_head, sizeof(exec_head));
                 warnx("%s: bad format", fname);          bytes = fread((char *)&exec_head, 1, sizeof(exec_head), fp);
                 (void)fclose(fp);          if (bytes < sizeof(exec_head)) {
                 return(1);                  if (bytes < sizeof(exec_head.aout) || IS_ELF(exec_head.elf)) {
                           warnx("%s: bad format", fname);
                           (void)fclose(fp);
                           return(1);
                   }
         }          }
         rewind(fp);          rewind(fp);
   

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24