Changeset 587 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Feb 18, 2015, 1:31:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r585 r587 3511 3511 * @param mimeType the content mimeType 3512 3512 * @param length the content size 3513 */ 3514 void addToCache(maps* conf,char* request,char* content,char* mimeType,int length){ 3513 * @param filepath a buffer for storing the path of the cached file; may be NULL 3514 * @param max_path the size of the allocated filepath buffer 3515 */ 3516 void addToCache(maps* conf,char* request,char* content,char* mimeType,int length, 3517 char* filepath, size_t max_path){ 3515 3518 map* tmp=getMapFromMaps(conf,"main","cacheDir"); 3516 3519 if(tmp!=NULL){ … … 3524 3527 FILE* fo=fopen(fname,"w+"); 3525 3528 if(fo==NULL){ 3526 fprintf (stderr, "Failed to open %s for writting: %s\n",fname, strerror(errno)); 3529 #ifdef DEBUG 3530 fprintf (stderr, "Failed to open %s for writing: %s\n",fname, strerror(errno)); 3531 #endif 3532 filepath = NULL; 3527 3533 return; 3528 3534 } 3529 3535 fwrite(content,sizeof(char),length,fo); 3530 3536 fclose(fo); 3537 3538 if (filepath != NULL) { 3539 strncpy(filepath, fname, max_path); 3540 } 3531 3541 3532 3542 sprintf(fname,"%s/%s.zcm",tmp->value,md5str); … … 3541 3551 free(fname); 3542 3552 } 3553 else { 3554 filepath = NULL; 3555 } 3543 3556 } 3544 3557 … … 3665 3678 } 3666 3679 addToMap(content->content,sname,ltmp1); 3667 addToCache(*m,tmp1->value,fcontent,mimeType,fsize );3680 addToCache(*m,tmp1->value,fcontent,mimeType,fsize, NULL, 0); 3668 3681 free(fcontent); 3669 3682 free(mimeType); … … 3767 3780 addToMap(*content,"size",ltmp1); 3768 3781 if(cached==NULL){ 3769 addToCache(*m,url,fcontent,mimeType,fsize );3782 addToCache(*m,url,fcontent,mimeType,fsize, NULL, 0); 3770 3783 } 3771 3784 else{
Note: See TracChangeset
for help on using the changeset viewer.