Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. for(I = 0; I < v->inodes_num; I++)
  2. {
  3. if(v->inodes[I].flags & VFS_FLAG_IN_USE && v->inodes[I].flags & VFS_FLAG_IS_START
  4. && strncmp(v->inodes[I].name, destination_file_name, NAME_MAX) == 0)
  5. {
  6. int i, isConflict;
  7.  
  8. do
  9. { isConflict = 0;
  10. //prepending "KH_" to a file name
  11. //strcpy(temp, v->inodes[I].name);
  12. //strcpy(v->inodes[I].name, "KH_");
  13. //strcat(v->inodes[I].name,temp);
  14. strcpy(temp1, v->inodes[I].name);
  15. strcpy(temp2, "KH_");
  16. strcat(temp2,temp1); //temp2 - my new file name
  17. //printf("\nCurrentFileName: %s\n", temp2);
  18.  
  19. for(i=0; i< v->inodes_num; i++)
  20. { //printf("\n#%dxD\n", i);
  21. if(strcmp(temp2, v->inodes[i].name) == 0)//another file name conflict
  22. { //printf("\nZnaleziono konflikt nazw z: %s\n", v->inodes[i].name);
  23. //char ch;
  24. //ch = getchar();
  25. //ch += 0;
  26. isConflict = 1;
  27. break;
  28. }
  29.  
  30. }
  31. strcpy(v->inodes[I].name, temp2);
  32. }
  33. while(isConflict == 1);
  34.  
  35. if(strlen(v->inodes[I].name) > NAME_MAX) //name too long
  36. return -2;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement