Changeset 653 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Jun 12, 2015, 1:12:32 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r652 r653 57 57 FILE* f0 = fopen (fbkpid, "r"); 58 58 if(f0!=NULL){ 59 long flen; 60 char *fcontent; 59 61 fseek (f0, 0, SEEK_END); 60 longflen = ftell (f0);62 flen = ftell (f0); 61 63 fseek (f0, 0, SEEK_SET); 62 char *tmps1= (char *) malloc ((flen + 1) * sizeof (char));63 fread( tmps1,flen,1,f0);64 tmps1[flen]=0;64 fcontent = (char *) malloc ((flen + 1) * sizeof (char)); 65 fread(fcontent,flen,1,f0); 66 fcontent[flen]=0; 65 67 fclose(f0); 66 return tmps1;68 return fcontent; 67 69 }else 68 70 return NULL; … … 188 190 FILE* f0 = fopen (fbkpid, "r"); 189 191 if(f0!=NULL){ 190 char* stat=getStatusId(conf,lid); 192 semid lockid; 193 char* stat; 194 long flen; 195 stat=getStatusId(conf,lid); 191 196 if(stat!=NULL){ 192 197 setMapInMaps(conf,"lenv","lid",stat); 193 semidlockid=acquireLock(conf);198 lockid=acquireLock(conf); 194 199 if(lockid<0) 195 200 return NULL; 196 201 } 197 202 fseek (f0, 0, SEEK_END); 198 longflen = ftell (f0);203 flen = ftell (f0); 199 204 if(flen>0){ 205 char *fcontent; 200 206 fseek (f0, 0, SEEK_SET); 201 char *tmps1= (char *) malloc ((flen + 1) * sizeof (char));202 fread( tmps1,flen,1,f0);203 tmps1[flen]=0;207 fcontent = (char *) malloc ((flen + 1) * sizeof (char)); 208 fread(fcontent,flen,1,f0); 209 fcontent[flen]=0; 204 210 fclose(f0); 205 211 free(fbkpid); … … 208 214 free(stat); 209 215 } 210 return tmps1;216 return fcontent; 211 217 } 212 218 fclose(f0);
Note: See TracChangeset
for help on using the changeset viewer.