IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15733


Ignore:
Timestamp:
Dec 5, 2007, 11:26:34 AM (18 years ago)
Author:
eugene
Message:

adding calls to perror for fread errors

Location:
branches/eam_branch_20071130/Ohana/src/libfits
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071130/Ohana/src/libfits/header/F_read_H.c

    r15487 r15733  
    3434    Nbytes = fread (&header[0].buffer[i*FT_RECORD_SIZE],
    3535                    sizeof(char), FT_RECORD_SIZE, f);
     36    if (Nbytes != FT_RECORD_SIZE) {
     37      perror ("fits read error");
     38    }
     39   
    3640    header[0].size += Nbytes;
    3741    if (Nbytes != FT_RECORD_SIZE) {
  • branches/eam_branch_20071130/Ohana/src/libfits/include/gfitsio.h

    r15732 r15733  
    22
    33# include <assert.h>
     4# include <errno.h>
    45
    56# ifndef GFITSIO
  • branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_load_M.c

    r15487 r15733  
    3030
    3131  nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
     32  if (nbytes != Nbytes) {
     33    perror ("fits matrix read error");
     34  }
    3235
    3336# ifdef BYTE_SWAP 
  • branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_portion.c

    r7054 r15733  
    4747  fseek (f, header.size + Nskip, SEEK_SET);
    4848  nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
     49  if (nbytes != Nbytes) {
     50    perror ("fits matrix read error");
     51  }
     52
    4953  fclose (f);
    5054
  • branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_segment.c

    r13039 r15733  
    9090  fseek (f, Nskip, SEEK_CUR);
    9191  nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
     92  if (nbytes != Nbytes) {
     93    perror ("fits matrix read error");
     94  }
     95
    9296  matrix[0].size = Nbytes;
    9397
  • branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c

    r15732 r15733  
    5959  Nread = fread (table[0].buffer, sizeof (char), Nbytes, f);
    6060  if (Nread != Nbytes) {
     61    perror ("fits read error");
    6162    gfits_free_table  (table);
    6263    return (FALSE);
     
    8485
    8586  fseek (f, Nskip, SEEK_CUR);
     87  fprintf (stderr, "file is at %ld\n", ftell(f));
     88
    8689  Nread = fread (buffer, sizeof (char), Nbytes, f);
    8790  if (Nread != Nbytes) {
     91    perror ("fits read error");
    8892    free (buffer);
    8993    return (FALSE);
     
    120124  Nread = fread (buffer, sizeof (char), Nbytes, f);
    121125  if (Nread != Nbytes) {
     126    perror ("fits read error");
    122127    free (buffer);
    123128    return (FALSE);
     
    178183      fseek (f, offset, SEEK_SET);
    179184      Nread = fread (table[0].buffer[i], sizeof (char), Nx, f);
    180       if (Nread != Nx) { return (FALSE); }
     185      if (Nread != Nx) {
     186        perror ("fits read error");
     187        return (FALSE);
     188      }
    181189    }
    182190
  • branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_TH.c

    r15487 r15733  
    4646    Nbytes = fread (&Theader[0].buffer[i*FT_RECORD_SIZE],
    4747                    sizeof(char), FT_RECORD_SIZE, f);
     48    if (Nbytes != FT_RECORD_SIZE) {
     49      perror ("fits matrix read error");
     50    }
     51
    4852    Theader[0].size += Nbytes;
    4953    if (Nbytes != FT_RECORD_SIZE)
Note: See TracChangeset for help on using the changeset viewer.