summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/grfio.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/common/grfio.c b/src/common/grfio.c
index 507b66cb3..b005398cc 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -444,13 +444,13 @@ int grfio_size(char *fname)
entry = filelist_find(fname);
if (entry==NULL || entry->gentry<0) { // LocalFileCheck
- char lfname[256],rname[256],*p;
+ char lfname[256],*rname,*p;
FILELIST lentry;
struct stat st;
- if(strcmp(data_dir, "") != 0) {
+ if(strcmp(data_dir, "") != 0 && (rname=grfio_resnametable(fname,lfname))!=NULL) {
//printf("%s\t",fname);
- sprintf(rname,"%s",grfio_resnametable(fname,lfname));
+ //sprintf(rname,"%s",grfio_resnametable(fname,lfname));
//printf("%s\n",rname);
sprintf(lfname,"%s%s",data_dir,rname);
//printf("%s\n",lfname);
@@ -486,13 +486,16 @@ void* grfio_reads(char *fname, int *size)
entry = filelist_find(fname);
if (entry==NULL || entry->gentry<=0) { // LocalFileCheck
- char lfname[256],rname[256],*p;
+ char lfname[256],*rname,*p;
FILELIST lentry;
strncpy(lfname,fname,255);
- sprintf(rname,"%s",grfio_resnametable(fname,lfname));
- sprintf(lfname,"%s%s",data_dir,rname);
- //printf("%s\n",lfname);
+ // i hope this is the correct way =p [celest]
+ if ((rname=grfio_resnametable(fname,lfname))!=NULL) {
+ //sprintf(rname,"%s",grfio_resnametable(fname,lfname));
+ sprintf(lfname,"%s%s",data_dir,rname);
+ //printf("%s\n",lfname);
+ }
for(p=&lfname[0];*p!=0;p++) if (*p=='\\') *p = '/'; // * At the time of Unix