mirror of
				https://github.com/pbatard/rufus.git
				synced 2024-08-14 23:57:05 +00:00 
			
		
		
		
	[core] (re)add a retry when writing ISO files
* Fixes the issue that caused a revert of0206e2036e(inc93798b877). The issue was that an active index was being reused and modified, for ISO9660 images, which could wreck havoc when writing the data blocks. * Closes #176 (again)
This commit is contained in:
		
							parent
							
								
									34f467a26e
								
							
						
					
					
						commit
						56c6b15feb
					
				
					 2 changed files with 28 additions and 15 deletions
				
			
		
							
								
								
									
										23
									
								
								src/iso.c
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								src/iso.c
									
										
									
									
									
								
							|  | @ -47,6 +47,7 @@ | |||
| // the progress bar for every block will bring extraction to a crawl
 | ||||
| #define PROGRESS_THRESHOLD        128 | ||||
| #define FOUR_GIGABYTES            4294967296LL | ||||
| #define WRITE_RETRIES             3 | ||||
| 
 | ||||
| // Needed for UDF ISO access
 | ||||
| CdIo_t* cdio_open (const char* psz_source, driver_id_t driver_id) {return NULL;} | ||||
|  | @ -284,11 +285,17 @@ static int udf_extract_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const cha | |||
| 					goto out; | ||||
| 				} | ||||
| 				buf_size = (DWORD)MIN(i_file_length, i_read); | ||||
| 				for (i=0; i<WRITE_RETRIES; i++) { | ||||
| 					ISO_BLOCKING(r = WriteFile(file_handle, buf, buf_size, &wr_size, NULL)); | ||||
| 					if ((!r) || (buf_size != wr_size)) { | ||||
| 					uprintf("  Error writing file: %s\n", WindowsErrorString()); | ||||
| 					goto out; | ||||
| 						uprintf("  Error writing file: %s", WindowsErrorString()); | ||||
| 						if (i < WRITE_RETRIES-1) | ||||
| 							uprintf("  RETRYING...\n"); | ||||
| 					} else { | ||||
| 						break; | ||||
| 					} | ||||
| 				} | ||||
| 				if (i >= WRITE_RETRIES) goto out; | ||||
| 				i_file_length -= i_read; | ||||
| 				if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { | ||||
| 					SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); | ||||
|  | @ -333,7 +340,7 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | |||
| 	CdioListNode_t* p_entnode; | ||||
| 	iso9660_stat_t *p_statbuf; | ||||
| 	CdioList_t* p_entlist; | ||||
| 	size_t i, nul_pos; | ||||
| 	size_t i, j, nul_pos; | ||||
| 	lsn_t lsn; | ||||
| 	int64_t i_file_length; | ||||
| 
 | ||||
|  | @ -419,11 +426,17 @@ static int iso_extract_files(iso9660_t* p_iso, const char *psz_path) | |||
| 					goto out; | ||||
| 				} | ||||
| 				buf_size = (DWORD)MIN(i_file_length, ISO_BLOCKSIZE); | ||||
| 				for (j=0; j<WRITE_RETRIES; j++) { | ||||
| 					ISO_BLOCKING(s = WriteFile(file_handle, buf, buf_size, &wr_size, NULL)); | ||||
| 					if ((!s) || (buf_size != wr_size)) { | ||||
| 					uprintf("  Error writing file: %s\n", WindowsErrorString()); | ||||
| 					goto out; | ||||
| 						uprintf("  Error writing file: %s", WindowsErrorString()); | ||||
| 						if (j < WRITE_RETRIES-1) | ||||
| 							uprintf("  RETRYING...\n"); | ||||
| 					} else { | ||||
| 						break; | ||||
| 					} | ||||
| 				} | ||||
| 				if (j >= WRITE_RETRIES) goto out; | ||||
| 				i_file_length -= ISO_BLOCKSIZE; | ||||
| 				if (nb_blocks++ % PROGRESS_THRESHOLD == 0) { | ||||
| 					SendMessage(hISOProgressBar, PBM_SETPOS, (WPARAM)((MAX_PROGRESS*nb_blocks)/total_blocks), 0); | ||||
|  |  | |||
							
								
								
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								src/rufus.rc
									
										
									
									
									
								
							|  | @ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL | |||
| IDD_DIALOG DIALOGEX 12, 12, 206, 329 | ||||
| STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | ||||
| EXSTYLE WS_EX_APPWINDOW | ||||
| CAPTION "Rufus v1.4.1.349" | ||||
| CAPTION "Rufus v1.4.1.350" | ||||
| FONT 8, "MS Shell Dlg", 400, 0, 0x1 | ||||
| BEGIN | ||||
|     DEFPUSHBUTTON   "Start",IDC_START,94,291,50,14 | ||||
|  | @ -288,8 +288,8 @@ END | |||
| // | ||||
| 
 | ||||
| VS_VERSION_INFO VERSIONINFO | ||||
|  FILEVERSION 1,4,1,349 | ||||
|  PRODUCTVERSION 1,4,1,349 | ||||
|  FILEVERSION 1,4,1,350 | ||||
|  PRODUCTVERSION 1,4,1,350 | ||||
|  FILEFLAGSMASK 0x3fL | ||||
| #ifdef _DEBUG | ||||
|  FILEFLAGS 0x1L | ||||
|  | @ -306,13 +306,13 @@ BEGIN | |||
|         BEGIN | ||||
|             VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" | ||||
|             VALUE "FileDescription", "Rufus" | ||||
|             VALUE "FileVersion", "1.4.1.349" | ||||
|             VALUE "FileVersion", "1.4.1.350" | ||||
|             VALUE "InternalName", "Rufus" | ||||
|             VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" | ||||
|             VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" | ||||
|             VALUE "OriginalFilename", "rufus.exe" | ||||
|             VALUE "ProductName", "Rufus" | ||||
|             VALUE "ProductVersion", "1.4.1.349" | ||||
|             VALUE "ProductVersion", "1.4.1.350" | ||||
|         END | ||||
|     END | ||||
|     BLOCK "VarFileInfo" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue