IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 10, 2007, 5:40:18 PM (19 years ago)
Author:
Paul Price
Message:

pmConfigConvertFilename shouldn't be creating files, just seeing if they can be accessed for reading.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r13207 r13346  
    44 *  @author EAM (IfA)
    55 *
    6  *  @version $Revision: 1.92 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-05-04 00:46:42 $
     6 *  @version $Revision: 1.93 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-05-11 03:40:18 $
    88 *
    99 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    10871087        newName = tmpName;
    10881088
    1089         // open the to create it if it doesn't exist.  This could cause a
    1090         // strange looking error if we can't access the file.
    1091         // XXX perhaps we should try access() first? -JH
    1092         int fd = open(newName, O_RDONLY|O_CREAT);
    1093         if (fd < 0) {
    1094             psError(PS_ERR_IO, true, "unable to open() file %s", newName);
    1095             psFree(newName);
    1096             return NULL;
    1097         }
    1098         if (close(fd) < 0) {
    1099             psError(PS_ERR_IO, true, "unable to open() file %s", newName);
     1089        if (!create && access(newName, R_OK) != 0) {
     1090            psError(PS_ERR_IO, true, "Unable to access file %s", newName);
    11001091            psFree(newName);
    11011092            return NULL;
     
    11451136        newName = tmpName;
    11461137
    1147         // open the to create it if it doesn't exist.  This could cause a
    1148         // strange looking error if we can't access the file.
    1149         // XXX perhaps we should try access() first? -JH
    1150         int fd = open(newName, O_RDONLY|O_CREAT);
    1151         if (fd < 0) {
    1152             psError(PS_ERR_IO, true, "unable to open() file %s", newName);
     1138        if (!create && access(newName, R_OK) != 0) {
     1139            psError(PS_ERR_IO, true, "Unable to access file %s", newName);
    11531140            psFree(newName);
    11541141            return NULL;
    11551142        }
    1156         if (close(fd) < 0) {
    1157             psError(PS_ERR_IO, true, "unable to open() file %s", newName);
    1158             psFree(newName);
    1159             return NULL;
    1160         }
    1161 
    11621143        return newName;
    11631144    }
Note: See TracChangeset for help on using the changeset viewer.