int mf_create_dir(char *newdir)
{
- char *buffer ;
- char *p;
- int len = (int)strlen(newdir);
-
- if (len <= 0) {
- return 0;
- }
-
- buffer = (char*)malloc(len+1);
- strncpy(buffer,newdir, strlen(newdir));
-
- if (buffer[len-1] == '/') {
- buffer[len-1] = '\0';
- }
- if (mf_create_new_dir(buffer) == 0) {
- free(buffer);
- return 1;
- }
-
- p = buffer+1;
- while (1) {
- char hold;
-
- while(*p && *p != '\\' && *p != '/')
- p++;
- hold = *p;
- *p = 0;
- if ((mf_create_new_dir(buffer) == -1) && (errno == ENOENT)) {
- mf_debug("couldn't create directory %s\n",buffer);
- free(buffer);
- return 0;
- }
- if (hold == 0) {
- break;
- }
- *p++ = hold;
- }
- free(buffer);
+ mf_create_new_dir(newdir);
return 1;
}
if ((skip==0) && (err==UNZ_OK)) {
fout=fopen(write_filename,"wb");
-
/* some zipfile don't contain directory alone before file */
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
- (filename_withoutpath!=(char*)filename_inzip)) {
- char c=*(filename_withoutpath-1);
+ strcmp(filename_withoutpath, filename_inzip)) {
+ char c = *(filename_withoutpath-1);
*(filename_withoutpath-1)='\0';
mf_create_dir(write_filename);
*(filename_withoutpath-1)=c;