Revision 2164 libsylph/procmsg.c

View differences:

procmsg.c
790 790
{
791 791
	FILE *fp;
792 792

  
793
	if ((fp = procmsg_open_mark_file(item, DATA_WRITE)) == NULL)
793
	if ((fp = procmsg_open_mark_file(item, DATA_WRITE)) == NULL) {
794
		g_warning("procmsg_write_mark_file: cannot open mark file.");
794 795
		return;
796
	}
795 797
	g_hash_table_foreach(mark_table, write_mark_func, fp);
796 798
	fclose(fp);
797 799
}
......
809 811
			if (errno == EACCES) {
810 812
				change_file_mode_rw(NULL, file);
811 813
				if ((fp = g_fopen(file, "wb")) == NULL) {
812
					FILE_OP_ERROR(file, "fopen");
814
					FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
813 815
					return NULL;
814 816
				}
815 817
			} else {
816
				FILE_OP_ERROR(file, "fopen");
818
				FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
817 819
				return NULL;
818 820
			}
819 821
		}
......
829 831
		if (errno == EACCES) {
830 832
			change_file_mode_rw(NULL, file);
831 833
			if ((fp = g_fopen(file, "rb")) == NULL) {
832
				FILE_OP_ERROR(file, "fopen");
834
				FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
833 835
			}
834 836
		} else {
835 837
			debug_print("Mark/Cache file '%s' not found\n", file);
......
839 841
	if (fp) {
840 842
		if (buf && buf_size > 0)
841 843
			setvbuf(fp, buf, _IOFBF, buf_size);
842
		if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1 ||
843
		    version != data_ver) {
844
		if (fread(&data_ver, sizeof(data_ver), 1, fp) != 1) {
845
			g_warning("%s: cannot read mark/cache file (truncated?)\n", file);
846
			fclose(fp);
847
			fp = NULL;
848
		} else if (version != data_ver) {
844 849
			g_message("%s: Mark/Cache version is different (%u != %u). Discarding it.\n",
845 850
				  file, data_ver, version);
846 851
			fclose(fp);
......
858 863
			if (errno == EACCES) {
859 864
				change_file_mode_rw(NULL, file);
860 865
				if ((fp = g_fopen(file, "ab")) == NULL) {
861
					FILE_OP_ERROR(file, "fopen");
866
					FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
862 867
				}
863 868
			} else {
864
				FILE_OP_ERROR(file, "fopen");
869
				FILE_OP_ERROR(file, "procmsg_open_data_file: fopen");
865 870
			}
866 871
		}
867 872
	} else {
......
1196 1201
	}
1197 1202

  
1198 1203
	if ((fp = g_fopen(file, "rb")) == NULL) {
1199
		FILE_OP_ERROR(file, "fopen");
1204
		FILE_OP_ERROR(file, "procmsg_open_message: fopen");
1200 1205
		g_free(file);
1201 1206
		return NULL;
1202 1207
	}
......
1413 1418
				print_id++);
1414 1419

  
1415 1420
	if ((prfp = g_fopen(prtmp, "wb")) == NULL) {
1416
		FILE_OP_ERROR(prtmp, "fopen");
1421
		FILE_OP_ERROR(prtmp, "procmsg_print_message: fopen");
1417 1422
		g_free(prtmp);
1418 1423
		fclose(tmpfp);
1419 1424
		return;
......
1506 1511
				get_mime_tmp_dir(), G_DIR_SEPARATOR,
1507 1512
				print_id++);
1508 1513
	if ((prfp = g_fopen(prtmp, "wb")) == NULL) {
1509
		FILE_OP_ERROR(prtmp, "fopen");
1514
		FILE_OP_ERROR(prtmp, "procmsg_print_message_part: fopen");
1510 1515
		g_free(prtmp);
1511 1516
		fclose(tmpfp);
1512 1517
		return;

Also available in: Unified diff