aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-06 09:18:49 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-06 09:18:49 +0000
commita0e80c722ac559fcc185c0fcbdc0e590bf7643c4 (patch)
treed895b0e854eab65fb9c6b36eed0d6129510a3d54 /src/fs/fs.c
parentd9ecb54d889d99ac7d0668db2a2606dece4d97e9 (diff)
downloadgnunet-a0e80c722ac559fcc185c0fcbdc0e590bf7643c4.tar.gz
gnunet-a0e80c722ac559fcc185c0fcbdc0e590bf7643c4.zip
breaks and bugfix
Diffstat (limited to 'src/fs/fs.c')
-rw-r--r--src/fs/fs.c222
1 files changed, 177 insertions, 45 deletions
diff --git a/src/fs/fs.c b/src/fs/fs.c
index aa41f6855..778f80984 100644
--- a/src/fs/fs.c
+++ b/src/fs/fs.c
@@ -781,13 +781,19 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
781 GNUNET_BIO_read_int32 (rh, &ret->anonymity)) || 781 GNUNET_BIO_read_int32 (rh, &ret->anonymity)) ||
782 (GNUNET_OK != 782 (GNUNET_OK !=
783 GNUNET_BIO_read_int32 (rh, &ret->priority)) ) 783 GNUNET_BIO_read_int32 (rh, &ret->priority)) )
784 goto cleanup; 784 {
785 GNUNET_break (0);
786 goto cleanup;
787 }
785 switch (b) 788 switch (b)
786 { 789 {
787 case 0: /* file-insert */ 790 case 0: /* file-insert */
788 if (GNUNET_OK != 791 if (GNUNET_OK !=
789 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) 792 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size))
790 goto cleanup; 793 {
794 GNUNET_break (0);
795 goto cleanup;
796 }
791 ret->is_directory = GNUNET_NO; 797 ret->is_directory = GNUNET_NO;
792 ret->data.file.do_index = GNUNET_NO; 798 ret->data.file.do_index = GNUNET_NO;
793 ret->data.file.have_hash = GNUNET_NO; 799 ret->data.file.have_hash = GNUNET_NO;
@@ -802,7 +808,10 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
802 goto cleanup; 808 goto cleanup;
803 if (GNUNET_OK != 809 if (GNUNET_OK !=
804 GNUNET_BIO_read (rh, "file-data", ret->data.file.reader_cls, ret->data.file.file_size)) 810 GNUNET_BIO_read (rh, "file-data", ret->data.file.reader_cls, ret->data.file.file_size))
805 goto cleanup; 811 {
812 GNUNET_break (0);
813 goto cleanup;
814 }
806 } 815 }
807 else 816 else
808 { 817 {
@@ -813,10 +822,16 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
813 break; 822 break;
814 case 1: /* file-index, no hash */ 823 case 1: /* file-index, no hash */
815 if (NULL == ret->filename) 824 if (NULL == ret->filename)
816 goto cleanup; 825 {
826 GNUNET_break (0);
827 goto cleanup;
828 }
817 if (GNUNET_OK != 829 if (GNUNET_OK !=
818 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) 830 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size))
819 goto cleanup; 831 {
832 GNUNET_break (0);
833 goto cleanup;
834 }
820 ret->is_directory = GNUNET_NO; 835 ret->is_directory = GNUNET_NO;
821 ret->data.file.do_index = GNUNET_YES; 836 ret->data.file.do_index = GNUNET_YES;
822 ret->data.file.have_hash = GNUNET_NO; 837 ret->data.file.have_hash = GNUNET_NO;
@@ -826,12 +841,18 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
826 break; 841 break;
827 case 2: /* file-index-with-hash */ 842 case 2: /* file-index-with-hash */
828 if (NULL == ret->filename) 843 if (NULL == ret->filename)
829 goto cleanup; 844 {
845 GNUNET_break (0);
846 goto cleanup;
847 }
830 if ( (GNUNET_OK != 848 if ( (GNUNET_OK !=
831 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) || 849 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
832 (GNUNET_OK != 850 (GNUNET_OK !=
833 GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id, sizeof (GNUNET_HashCode))) ) 851 GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id, sizeof (GNUNET_HashCode))) )
834 goto cleanup; 852 {
853 GNUNET_break (0);
854 goto cleanup;
855 }
835 ret->is_directory = GNUNET_NO; 856 ret->is_directory = GNUNET_NO;
836 ret->data.file.do_index = GNUNET_YES; 857 ret->data.file.do_index = GNUNET_YES;
837 ret->data.file.have_hash = GNUNET_YES; 858 ret->data.file.have_hash = GNUNET_YES;
@@ -841,13 +862,18 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
841 break; 862 break;
842 case 3: /* file-index-with-hash-confirmed */ 863 case 3: /* file-index-with-hash-confirmed */
843 if (NULL == ret->filename) 864 if (NULL == ret->filename)
844 goto cleanup; 865 {
866 GNUNET_break (0);
867 goto cleanup;
868 }
845 if ( (GNUNET_OK != 869 if ( (GNUNET_OK !=
846 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) || 870 GNUNET_BIO_read_int64 (rh, &ret->data.file.file_size)) ||
847 (GNUNET_OK != 871 (GNUNET_OK !=
848 GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id, sizeof (GNUNET_HashCode))) ) 872 GNUNET_BIO_read (rh, "fileid", &ret->data.file.file_id, sizeof (GNUNET_HashCode))) )
849 goto cleanup; 873 {
850 874 GNUNET_break (0);
875 goto cleanup;
876 }
851 ret->is_directory = GNUNET_NO; 877 ret->is_directory = GNUNET_NO;
852 ret->data.file.do_index = GNUNET_YES; 878 ret->data.file.do_index = GNUNET_YES;
853 ret->data.file.have_hash = GNUNET_YES; 879 ret->data.file.have_hash = GNUNET_YES;
@@ -863,7 +889,10 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
863 GNUNET_BIO_read (rh, "dir-data", ret->data.dir.dir_data, dsize)) || 889 GNUNET_BIO_read (rh, "dir-data", ret->data.dir.dir_data, dsize)) ||
864 (GNUNET_OK != 890 (GNUNET_OK !=
865 GNUNET_BIO_read_string (rh, "ent-filename", &filename, 16*1024)) ) 891 GNUNET_BIO_read_string (rh, "ent-filename", &filename, 16*1024)) )
866 goto cleanup; 892 {
893 GNUNET_break (0);
894 goto cleanup;
895 }
867 ret->data.dir.dir_size = (uint32_t) dsize; 896 ret->data.dir.dir_size = (uint32_t) dsize;
868 ret->is_directory = GNUNET_YES; 897 ret->is_directory = GNUNET_YES;
869 if (filename != NULL) 898 if (filename != NULL)
@@ -886,7 +915,10 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
886 ret->serialization = GNUNET_strdup (fn); 915 ret->serialization = GNUNET_strdup (fn);
887 if (GNUNET_OK != 916 if (GNUNET_OK !=
888 GNUNET_BIO_read_string (rh, "nxt-filename", &filename, 16*1024)) 917 GNUNET_BIO_read_string (rh, "nxt-filename", &filename, 16*1024))
889 goto cleanup; 918 {
919 GNUNET_break (0);
920 goto cleanup;
921 }
890 if (filename != NULL) 922 if (filename != NULL)
891 { 923 {
892 ret->next = deserialize_file_information (h, filename); 924 ret->next = deserialize_file_information (h, filename);
@@ -1148,7 +1180,10 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
1148 GNUNET_BIO_write_int32 (wh, fi->anonymity)) || 1180 GNUNET_BIO_write_int32 (wh, fi->anonymity)) ||
1149 (GNUNET_OK != 1181 (GNUNET_OK !=
1150 GNUNET_BIO_write_int32 (wh, fi->priority)) ) 1182 GNUNET_BIO_write_int32 (wh, fi->priority)) )
1151 goto cleanup; 1183 {
1184 GNUNET_break (0);
1185 goto cleanup;
1186 }
1152 GNUNET_free_non_null (chks); 1187 GNUNET_free_non_null (chks);
1153 chks = NULL; 1188 chks = NULL;
1154 GNUNET_free_non_null (ksks); 1189 GNUNET_free_non_null (ksks);
@@ -1159,29 +1194,47 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
1159 case 0: /* file-insert */ 1194 case 0: /* file-insert */
1160 if (GNUNET_OK != 1195 if (GNUNET_OK !=
1161 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size)) 1196 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size))
1162 goto cleanup; 1197 {
1198 GNUNET_break (0);
1199 goto cleanup;
1200 }
1163 if ( (GNUNET_NO == fi->is_published) && 1201 if ( (GNUNET_NO == fi->is_published) &&
1164 (NULL == fi->filename) ) 1202 (NULL == fi->filename) )
1165 if (GNUNET_OK != 1203 if (GNUNET_OK !=
1166 copy_from_reader (wh, fi)) 1204 copy_from_reader (wh, fi))
1167 goto cleanup; 1205 {
1206 GNUNET_break (0);
1207 goto cleanup;
1208 }
1168 break; 1209 break;
1169 case 1: /* file-index, no hash */ 1210 case 1: /* file-index, no hash */
1170 if (NULL == fi->filename) 1211 if (NULL == fi->filename)
1171 goto cleanup; 1212 {
1213 GNUNET_break (0);
1214 goto cleanup;
1215 }
1172 if (GNUNET_OK != 1216 if (GNUNET_OK !=
1173 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size)) 1217 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size))
1174 goto cleanup; 1218 {
1219 GNUNET_break (0);
1220 goto cleanup;
1221 }
1175 break; 1222 break;
1176 case 2: /* file-index-with-hash */ 1223 case 2: /* file-index-with-hash */
1177 case 3: /* file-index-with-hash-confirmed */ 1224 case 3: /* file-index-with-hash-confirmed */
1178 if (NULL == fi->filename) 1225 if (NULL == fi->filename)
1179 goto cleanup; 1226 {
1227 GNUNET_break (0);
1228 goto cleanup;
1229 }
1180 if ( (GNUNET_OK != 1230 if ( (GNUNET_OK !=
1181 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size)) || 1231 GNUNET_BIO_write_int64 (wh, fi->data.file.file_size)) ||
1182 (GNUNET_OK != 1232 (GNUNET_OK !=
1183 GNUNET_BIO_write (wh, &fi->data.file.file_id, sizeof (GNUNET_HashCode))) ) 1233 GNUNET_BIO_write (wh, &fi->data.file.file_id, sizeof (GNUNET_HashCode))) )
1184 goto cleanup; 1234 {
1235 GNUNET_break (0);
1236 goto cleanup;
1237 }
1185 break; 1238 break;
1186 case 4: /* directory */ 1239 case 4: /* directory */
1187 if ( (GNUNET_OK != 1240 if ( (GNUNET_OK !=
@@ -1190,7 +1243,10 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
1190 GNUNET_BIO_write (wh, fi->data.dir.dir_data, (uint32_t) fi->data.dir.dir_size)) || 1243 GNUNET_BIO_write (wh, fi->data.dir.dir_data, (uint32_t) fi->data.dir.dir_size)) ||
1191 (GNUNET_OK != 1244 (GNUNET_OK !=
1192 GNUNET_BIO_write_string (wh, fi->data.dir.entries->serialization)) ) 1245 GNUNET_BIO_write_string (wh, fi->data.dir.entries->serialization)) )
1193 goto cleanup; 1246 {
1247 GNUNET_break (0);
1248 goto cleanup;
1249 }
1194 break; 1250 break;
1195 default: 1251 default:
1196 GNUNET_assert (0); 1252 GNUNET_assert (0);
@@ -1198,10 +1254,17 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation * fi)
1198 } 1254 }
1199 if (GNUNET_OK != 1255 if (GNUNET_OK !=
1200 GNUNET_BIO_write_string (wh, (fi->next != NULL) ? fi->next->serialization : NULL)) 1256 GNUNET_BIO_write_string (wh, (fi->next != NULL) ? fi->next->serialization : NULL))
1201 goto cleanup; 1257 {
1202 if (GNUNET_OK == 1258 GNUNET_break (0);
1259 goto cleanup;
1260 }
1261 if (GNUNET_OK !=
1203 GNUNET_BIO_write_close (wh)) 1262 GNUNET_BIO_write_close (wh))
1204 return; /* done! */ 1263 {
1264 GNUNET_break (0);
1265 goto cleanup;
1266 }
1267 return; /* done! */
1205 cleanup: 1268 cleanup:
1206 (void) GNUNET_BIO_write_close (wh); 1269 (void) GNUNET_BIO_write_close (wh);
1207 GNUNET_free_non_null (chks); 1270 GNUNET_free_non_null (chks);
@@ -1315,7 +1378,10 @@ deserialize_publish_file (void *cls,
1315 ns = NULL; 1378 ns = NULL;
1316 rh = GNUNET_BIO_read_open (filename); 1379 rh = GNUNET_BIO_read_open (filename);
1317 if (rh == NULL) 1380 if (rh == NULL)
1318 goto cleanup; 1381 {
1382 GNUNET_break (0);
1383 goto cleanup;
1384 }
1319 if ( (GNUNET_OK != 1385 if ( (GNUNET_OK !=
1320 GNUNET_BIO_read_string (rh, "publish-nid", &pc->nid, 1024)) || 1386 GNUNET_BIO_read_string (rh, "publish-nid", &pc->nid, 1024)) ||
1321 (GNUNET_OK != 1387 (GNUNET_OK !=
@@ -1330,12 +1396,18 @@ deserialize_publish_file (void *cls,
1330 GNUNET_BIO_read_string (rh, "publish-fipos", &fi_pos, 128)) || 1396 GNUNET_BIO_read_string (rh, "publish-fipos", &fi_pos, 128)) ||
1331 (GNUNET_OK != 1397 (GNUNET_OK !=
1332 GNUNET_BIO_read_string (rh, "publish-ns", &ns, 1024)) ) 1398 GNUNET_BIO_read_string (rh, "publish-ns", &ns, 1024)) )
1333 goto cleanup; 1399 {
1400 GNUNET_break (0);
1401 goto cleanup;
1402 }
1334 pc->options = options; 1403 pc->options = options;
1335 pc->all_done = all_done; 1404 pc->all_done = all_done;
1336 pc->fi = deserialize_file_information (h, fi_root); 1405 pc->fi = deserialize_file_information (h, fi_root);
1337 if (pc->fi == NULL) 1406 if (pc->fi == NULL)
1338 goto cleanup; 1407 {
1408 GNUNET_break (0);
1409 goto cleanup;
1410 }
1339 if (ns != NULL) 1411 if (ns != NULL)
1340 { 1412 {
1341 pc->namespace = GNUNET_FS_namespace_create (h, ns); 1413 pc->namespace = GNUNET_FS_namespace_create (h, ns);
@@ -1438,7 +1510,10 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc)
1438 } 1510 }
1439 wh = get_write_handle (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, pc->serialization); 1511 wh = get_write_handle (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH, pc->serialization);
1440 if (wh == NULL) 1512 if (wh == NULL)
1441 goto cleanup; 1513 {
1514 GNUNET_break (0);
1515 goto cleanup;
1516 }
1442 if ( (GNUNET_OK != 1517 if ( (GNUNET_OK !=
1443 GNUNET_BIO_write_string (wh, pc->nid)) || 1518 GNUNET_BIO_write_string (wh, pc->nid)) ||
1444 (GNUNET_OK != 1519 (GNUNET_OK !=
@@ -1454,12 +1529,14 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc)
1454 (GNUNET_OK != 1529 (GNUNET_OK !=
1455 GNUNET_BIO_write_string (wh, (pc->namespace == NULL) ? NULL : pc->namespace->name)) ) 1530 GNUNET_BIO_write_string (wh, (pc->namespace == NULL) ? NULL : pc->namespace->name)) )
1456 { 1531 {
1532 GNUNET_break (0);
1457 goto cleanup; 1533 goto cleanup;
1458 } 1534 }
1459 if (GNUNET_OK != 1535 if (GNUNET_OK !=
1460 GNUNET_BIO_write_close (wh)) 1536 GNUNET_BIO_write_close (wh))
1461 { 1537 {
1462 wh = NULL; 1538 wh = NULL;
1539 GNUNET_break (0);
1463 goto cleanup; 1540 goto cleanup;
1464 } 1541 }
1465 return; 1542 return;
@@ -1494,7 +1571,10 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc)
1494 return; 1571 return;
1495 wh = get_write_handle (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization); 1572 wh = get_write_handle (uc->h, GNUNET_FS_SYNC_PATH_MASTER_UNINDEX, uc->serialization);
1496 if (wh == NULL) 1573 if (wh == NULL)
1497 goto cleanup; 1574 {
1575 GNUNET_break (0);
1576 goto cleanup;
1577 }
1498 if ( (GNUNET_OK != 1578 if ( (GNUNET_OK !=
1499 GNUNET_BIO_write_string (wh, uc->filename)) || 1579 GNUNET_BIO_write_string (wh, uc->filename)) ||
1500 (GNUNET_OK != 1580 (GNUNET_OK !=
@@ -1509,11 +1589,15 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc)
1509 ( (uc->state == UNINDEX_STATE_ERROR) && 1589 ( (uc->state == UNINDEX_STATE_ERROR) &&
1510 (GNUNET_OK != 1590 (GNUNET_OK !=
1511 GNUNET_BIO_write_string (wh, uc->emsg)) ) ) 1591 GNUNET_BIO_write_string (wh, uc->emsg)) ) )
1512 goto cleanup; 1592 {
1593 GNUNET_break (0);
1594 goto cleanup;
1595 }
1513 if (GNUNET_OK != 1596 if (GNUNET_OK !=
1514 GNUNET_BIO_write_close (wh)) 1597 GNUNET_BIO_write_close (wh))
1515 { 1598 {
1516 wh = NULL; 1599 wh = NULL;
1600 GNUNET_break (0);
1517 goto cleanup; 1601 goto cleanup;
1518 } 1602 }
1519 return; 1603 return;
@@ -1657,7 +1741,7 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc)
1657 (GNUNET_YES == GNUNET_FS_uri_test_loc (dc->uri)) ); 1741 (GNUNET_YES == GNUNET_FS_uri_test_loc (dc->uri)) );
1658 uris = GNUNET_FS_uri_to_string (dc->uri); 1742 uris = GNUNET_FS_uri_to_string (dc->uri);
1659 num_pending = 0; 1743 num_pending = 0;
1660 if (dc->emsg != NULL) 1744 if (dc->emsg == NULL)
1661 (void) GNUNET_CONTAINER_multihashmap_iterate (dc->active, 1745 (void) GNUNET_CONTAINER_multihashmap_iterate (dc->active,
1662 &count_download_requests, 1746 &count_download_requests,
1663 &num_pending); 1747 &num_pending);
@@ -1692,17 +1776,24 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc)
1692 GNUNET_BIO_write_int32 (wh, (uint32_t) dc->has_finished)) || 1776 GNUNET_BIO_write_int32 (wh, (uint32_t) dc->has_finished)) ||
1693 (GNUNET_OK != 1777 (GNUNET_OK !=
1694 GNUNET_BIO_write_int32 (wh, num_pending)) ) 1778 GNUNET_BIO_write_int32 (wh, num_pending)) )
1695 goto cleanup; 1779 {
1780 GNUNET_break (0);
1781 goto cleanup;
1782 }
1696 if (GNUNET_SYSERR == 1783 if (GNUNET_SYSERR ==
1697 GNUNET_CONTAINER_multihashmap_iterate (dc->active, 1784 GNUNET_CONTAINER_multihashmap_iterate (dc->active,
1698 &write_download_request, 1785 &write_download_request,
1699 wh)) 1786 wh))
1700 goto cleanup; 1787 {
1788 GNUNET_break (0);
1789 goto cleanup;
1790 }
1701 GNUNET_free_non_null (uris); 1791 GNUNET_free_non_null (uris);
1702 if (GNUNET_OK != 1792 if (GNUNET_OK !=
1703 GNUNET_BIO_write_close (wh)) 1793 GNUNET_BIO_write_close (wh))
1704 { 1794 {
1705 wh = NULL; 1795 wh = NULL;
1796 GNUNET_break (0);
1706 goto cleanup; 1797 goto cleanup;
1707 } 1798 }
1708 GNUNET_free (fn); 1799 GNUNET_free (fn);
@@ -1749,7 +1840,10 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr)
1749 sr->sc->serialization, 1840 sr->sc->serialization,
1750 sr->serialization); 1841 sr->serialization);
1751 if (wh == NULL) 1842 if (wh == NULL)
1752 goto cleanup; 1843 {
1844 GNUNET_break (0);
1845 goto cleanup;
1846 }
1753 uris = GNUNET_FS_uri_to_string (sr->uri); 1847 uris = GNUNET_FS_uri_to_string (sr->uri);
1754 if ( (GNUNET_OK != 1848 if ( (GNUNET_OK !=
1755 GNUNET_BIO_write_string (wh, uris)) || 1849 GNUNET_BIO_write_string (wh, uris)) ||
@@ -1769,11 +1863,15 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr)
1769 GNUNET_BIO_write_int32 (wh, sr->availability_success)) || 1863 GNUNET_BIO_write_int32 (wh, sr->availability_success)) ||
1770 (GNUNET_OK != 1864 (GNUNET_OK !=
1771 GNUNET_BIO_write_int32 (wh, sr->availability_trials)) ) 1865 GNUNET_BIO_write_int32 (wh, sr->availability_trials)) )
1772 goto cleanup; 1866 {
1867 GNUNET_break (0);
1868 goto cleanup;
1869 }
1773 if (GNUNET_OK != 1870 if (GNUNET_OK !=
1774 GNUNET_BIO_write_close (wh)) 1871 GNUNET_BIO_write_close (wh))
1775 { 1872 {
1776 wh = NULL; 1873 wh = NULL;
1874 GNUNET_break (0);
1777 goto cleanup; 1875 goto cleanup;
1778 } 1876 }
1779 GNUNET_free_non_null (uris); 1877 GNUNET_free_non_null (uris);
@@ -1819,7 +1917,10 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc)
1819 return; 1917 return;
1820 wh = get_write_handle (sc->h, category, sc->serialization); 1918 wh = get_write_handle (sc->h, category, sc->serialization);
1821 if (wh == NULL) 1919 if (wh == NULL)
1822 goto cleanup; 1920 {
1921 GNUNET_break (0);
1922 goto cleanup;
1923 }
1823 GNUNET_assert ( (GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) || 1924 GNUNET_assert ( (GNUNET_YES == GNUNET_FS_uri_test_ksk (sc->uri)) ||
1824 (GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri)) ); 1925 (GNUNET_YES == GNUNET_FS_uri_test_sks (sc->uri)) );
1825 uris = GNUNET_FS_uri_to_string (sc->uri); 1926 uris = GNUNET_FS_uri_to_string (sc->uri);
@@ -1836,13 +1937,17 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc)
1836 GNUNET_BIO_write (wh, &in_pause, sizeof (in_pause))) || 1937 GNUNET_BIO_write (wh, &in_pause, sizeof (in_pause))) ||
1837 (GNUNET_OK != 1938 (GNUNET_OK !=
1838 GNUNET_BIO_write_int32 (wh, sc->anonymity)) ) 1939 GNUNET_BIO_write_int32 (wh, sc->anonymity)) )
1839 goto cleanup; 1940 {
1941 GNUNET_break (0);
1942 goto cleanup;
1943 }
1840 GNUNET_free (uris); 1944 GNUNET_free (uris);
1841 uris = NULL; 1945 uris = NULL;
1842 if (GNUNET_OK != 1946 if (GNUNET_OK !=
1843 GNUNET_BIO_write_close (wh)) 1947 GNUNET_BIO_write_close (wh))
1844 { 1948 {
1845 wh = NULL; 1949 wh = NULL;
1950 GNUNET_break (0);
1846 goto cleanup; 1951 goto cleanup;
1847 } 1952 }
1848 return; 1953 return;
@@ -1880,7 +1985,10 @@ deserialize_unindex_file (void *cls,
1880 uc->serialization = get_serialization_short_name (filename); 1985 uc->serialization = get_serialization_short_name (filename);
1881 rh = GNUNET_BIO_read_open (filename); 1986 rh = GNUNET_BIO_read_open (filename);
1882 if (rh == NULL) 1987 if (rh == NULL)
1883 goto cleanup; 1988 {
1989 GNUNET_break (0);
1990 goto cleanup;
1991 }
1884 if ( (GNUNET_OK != 1992 if ( (GNUNET_OK !=
1885 GNUNET_BIO_read_string (rh, "unindex-fn", &uc->filename, 10*1024)) || 1993 GNUNET_BIO_read_string (rh, "unindex-fn", &uc->filename, 10*1024)) ||
1886 (GNUNET_OK != 1994 (GNUNET_OK !=
@@ -1889,7 +1997,10 @@ deserialize_unindex_file (void *cls,
1889 read_start_time (rh, &uc->start_time)) || 1997 read_start_time (rh, &uc->start_time)) ||
1890 (GNUNET_OK != 1998 (GNUNET_OK !=
1891 GNUNET_BIO_read_int32 (rh, &state)) ) 1999 GNUNET_BIO_read_int32 (rh, &state)) )
1892 goto cleanup; 2000 {
2001 GNUNET_break (0);
2002 goto cleanup;
2003 }
1893 uc->state = (enum UnindexState) state; 2004 uc->state = (enum UnindexState) state;
1894 switch (state) 2005 switch (state)
1895 { 2006 {
@@ -1898,7 +2009,10 @@ deserialize_unindex_file (void *cls,
1898 case UNINDEX_STATE_FS_NOTIFY: 2009 case UNINDEX_STATE_FS_NOTIFY:
1899 if (GNUNET_OK != 2010 if (GNUNET_OK !=
1900 GNUNET_BIO_read (rh, "unindex-hash", &uc->file_id, sizeof (GNUNET_HashCode))) 2011 GNUNET_BIO_read (rh, "unindex-hash", &uc->file_id, sizeof (GNUNET_HashCode)))
1901 goto cleanup; 2012 {
2013 GNUNET_break (0);
2014 goto cleanup;
2015 }
1902 break; 2016 break;
1903 case UNINDEX_STATE_DS_REMOVE: 2017 case UNINDEX_STATE_DS_REMOVE:
1904 break; 2018 break;
@@ -1907,7 +2021,10 @@ deserialize_unindex_file (void *cls,
1907 case UNINDEX_STATE_ERROR: 2021 case UNINDEX_STATE_ERROR:
1908 if (GNUNET_OK != 2022 if (GNUNET_OK !=
1909 GNUNET_BIO_read_string (rh, "unindex-emsg", &uc->emsg, 10*1024)) 2023 GNUNET_BIO_read_string (rh, "unindex-emsg", &uc->emsg, 10*1024))
1910 goto cleanup; 2024 {
2025 GNUNET_break (0);
2026 goto cleanup;
2027 }
1911 break; 2028 break;
1912 case UNINDEX_STATE_ABORTED: 2029 case UNINDEX_STATE_ABORTED:
1913 GNUNET_break (0); 2030 GNUNET_break (0);
@@ -2075,7 +2192,10 @@ deserialize_search_result (void *cls,
2075 GNUNET_BIO_read_int32 (rh, &sr->availability_success)) || 2192 GNUNET_BIO_read_int32 (rh, &sr->availability_success)) ||
2076 (GNUNET_OK != 2193 (GNUNET_OK !=
2077 GNUNET_BIO_read_int32 (rh, &sr->availability_trials)) ) 2194 GNUNET_BIO_read_int32 (rh, &sr->availability_trials)) )
2078 goto cleanup; 2195 {
2196 GNUNET_break (0);
2197 goto cleanup;
2198 }
2079 GNUNET_free (uris); 2199 GNUNET_free (uris);
2080 if (download != NULL) 2200 if (download != NULL)
2081 { 2201 {
@@ -2429,7 +2549,10 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2429 GNUNET_BIO_read_int32 (rh, &status)) || 2549 GNUNET_BIO_read_int32 (rh, &status)) ||
2430 (GNUNET_OK != 2550 (GNUNET_OK !=
2431 GNUNET_BIO_read_int32 (rh, &num_pending)) ) 2551 GNUNET_BIO_read_int32 (rh, &num_pending)) )
2432 goto cleanup; 2552 {
2553 GNUNET_break (0);
2554 goto cleanup;
2555 }
2433 dc->options = (enum GNUNET_FS_DownloadOptions) options; 2556 dc->options = (enum GNUNET_FS_DownloadOptions) options;
2434 dc->active = GNUNET_CONTAINER_multihashmap_create (16); 2557 dc->active = GNUNET_CONTAINER_multihashmap_create (16);
2435 dc->has_finished = (int) status; 2558 dc->has_finished = (int) status;
@@ -2440,7 +2563,10 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2440 &dc->target)); 2563 &dc->target));
2441 if ( (dc->length > dc->completed) && 2564 if ( (dc->length > dc->completed) &&
2442 (num_pending == 0) ) 2565 (num_pending == 0) )
2443 goto cleanup; 2566 {
2567 GNUNET_break (0);
2568 goto cleanup;
2569 }
2444 while (0 < num_pending--) 2570 while (0 < num_pending--)
2445 { 2571 {
2446 dr = GNUNET_malloc (sizeof (struct DownloadRequest)); 2572 dr = GNUNET_malloc (sizeof (struct DownloadRequest));
@@ -2450,7 +2576,10 @@ deserialize_download (struct GNUNET_FS_Handle *h,
2450 GNUNET_BIO_read_int64 (rh, &dr->offset)) || 2576 GNUNET_BIO_read_int64 (rh, &dr->offset)) ||
2451 (GNUNET_OK != 2577 (GNUNET_OK !=
2452 GNUNET_BIO_read_int32 (rh, &dr->depth)) ) 2578 GNUNET_BIO_read_int32 (rh, &dr->depth)) )
2453 goto cleanup; 2579 {
2580 GNUNET_break (0);
2581 goto cleanup;
2582 }
2454 dr->is_pending = GNUNET_YES; 2583 dr->is_pending = GNUNET_YES;
2455 dr->next = dc->pending; 2584 dr->next = dc->pending;
2456 dc->pending = dr; 2585 dc->pending = dr;
@@ -2564,7 +2693,10 @@ deserialize_search (struct GNUNET_FS_Handle *h,
2564 GNUNET_BIO_read (rh, "search-pause", &in_pause, sizeof (in_pause))) || 2693 GNUNET_BIO_read (rh, "search-pause", &in_pause, sizeof (in_pause))) ||
2565 (GNUNET_OK != 2694 (GNUNET_OK !=
2566 GNUNET_BIO_read_int32 (rh, &sc->anonymity)) ) 2695 GNUNET_BIO_read_int32 (rh, &sc->anonymity)) )
2567 goto cleanup; 2696 {
2697 GNUNET_break (0);
2698 goto cleanup;
2699 }
2568 sc->options = (enum GNUNET_FS_SearchOptions) options; 2700 sc->options = (enum GNUNET_FS_SearchOptions) options;
2569 sc->master_result_map = GNUNET_CONTAINER_multihashmap_create (16); 2701 sc->master_result_map = GNUNET_CONTAINER_multihashmap_create (16);
2570 dn = get_serialization_file_name_in_dir (h, 2702 dn = get_serialization_file_name_in_dir (h,