IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20358


Ignore:
Timestamp:
Oct 24, 2008, 1:38:30 PM (18 years ago)
Author:
eugene
Message:

allow for an empty or missing .ptolemyrc file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/src/config.c

    r16466 r20358  
    138138  /* open file */
    139139  f = fopen (filename, "r");
    140   if (f == NULL) {
    141     return ((char *) NULL);
    142   }
     140  // if (f == NULL) {
     141  // return ((char *) NULL);
     142  // }
    143143 
    144144  /* allocate tmp space, 2 extra bytes for a final return and EOL */
     
    148148   
    149149  /* load data from file */
    150   done = FALSE;
    151   while ((nbytes = fread (&ibuffer[Nbytes], sizeof(char), D_NBYTES, f)) == D_NBYTES) {
     150  if (f) {
     151    done = FALSE;
     152    while ((nbytes = fread (&ibuffer[Nbytes], sizeof(char), D_NBYTES, f)) == D_NBYTES) {
     153      Nbytes += nbytes;
     154      NBYTES += D_NBYTES;
     155      REALLOCATE (ibuffer, char, NBYTES + 2);
     156    }
    152157    Nbytes += nbytes;
    153     NBYTES += D_NBYTES;
    154     REALLOCATE (ibuffer, char, NBYTES + 2);
    155   }
    156   Nbytes += nbytes;
    157   fclose (f);
     158    fclose (f);
     159  }
    158160
    159161  /* add final return & EOL if non-existent */
Note: See TracChangeset for help on using the changeset viewer.