Changeset 14317
- Timestamp:
- Jul 4, 2014, 3:23:27 AM (8 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/rename-test.c
r14289 r14317 369 369 { 370 370 check_streq (expected_files[i], files[i].name); 371 check (testFileExistsAndConsistsOfThisString (tor, 1, expected_contents[1]));371 check (testFileExistsAndConsistsOfThisString (tor, i, expected_contents[i])); 372 372 } 373 373 check (files[0].is_renamed == false); … … 440 440 } 441 441 442 /** 443 *** Test renaming prefixes (shouldn't work) 444 **/ 445 446 tr_torrentRemove (tor, false, NULL); 447 do { 448 tr_wait_msec (10); 449 } while (0); 450 ctor = tr_ctorNew (session); 451 tor = create_torrent_from_base64_metainfo (ctor, 452 "ZDEwOmNyZWF0ZWQgYnkyNTpUcmFuc21pc3Npb24vMi42MSAoMTM0MDcpMTM6Y3JlYXRpb24gZGF0" 453 "ZWkxMzU4NTU1NDIwZTg6ZW5jb2Rpbmc1OlVURi04NDppbmZvZDU6ZmlsZXNsZDY6bGVuZ3RoaTI4" 454 "ZTQ6cGF0aGw3OkZlbGluYWU4OkFjaW5vbnl4NzpDaGVldGFoNzpDaGVzdGVyZWVkNjpsZW5ndGhp" 455 "MTJlNDpwYXRobDc6RmVsaW5hZTU6RmVsaXM1OmNhdHVzNTpLeXBoaWVlZDY6bGVuZ3RoaTZlNDpw" 456 "YXRobDc6RmVsaW5hZTU6RmVsaXM1OmNhdHVzNzpTYWZmcm9uZWVkNjpsZW5ndGhpMjFlNDpwYXRo" 457 "bDExOlBhbnRoZXJpbmFlODpQYW50aGVyYTU6VGlnZXI0OlRvbnllZWU0Om5hbWU3OkZlbGlkYWUx" 458 "MjpwaWVjZSBsZW5ndGhpMzI3NjhlNjpwaWVjZXMyMDp27buFkmy8ICfNX4nsJmt0Ckm2Ljc6cHJp" 459 "dmF0ZWkwZWVl"); 460 check (tr_isTorrent (tor)); 461 files = tor->info.files; 462 463 /* rename prefix of top */ 464 check_int_eq (EINVAL, torrentRenameAndWait (tor, "Feli", "FelidaeX")); 465 check_streq (tor->info.name, "Felidae"); 466 check (files[0].is_renamed == false); 467 check (files[1].is_renamed == false); 468 check (files[2].is_renamed == false); 469 check (files[3].is_renamed == false); 470 471 /* rename false path */ 472 check_int_eq (EINVAL, torrentRenameAndWait (tor, "Felidae/FelinaeX", "Genus Felinae")); 473 check_streq (tor->info.name, "Felidae"); 474 check (files[0].is_renamed == false); 475 check (files[1].is_renamed == false); 476 check (files[2].is_renamed == false); 477 check (files[3].is_renamed == false); 478 442 479 /*** 443 480 **** -
trunk/libtransmission/torrent.c
r14316 r14317 3593 3593 const char * name = tor->info.files[i].name; 3594 3594 const size_t len = strlen (name); 3595 if ((len >= oldpath_len) && !memcmp (oldpath, name, oldpath_len)) 3595 if ((len == oldpath_len || (len > oldpath_len && name[oldpath_len] == '/')) && 3596 !memcmp (oldpath, name, oldpath_len)) 3596 3597 indices[n++] = i; 3597 3598 } … … 3736 3737 if (n == 0) 3737 3738 { 3738 err no= EINVAL;3739 error = EINVAL; 3739 3740 } 3740 3741 else
Note: See TracChangeset
for help on using the changeset viewer.