Cygwin: FIFO: make certain errors non-fatal
If update_my_handlers fails to duplicate one or more handles, just mark the corresponding handlers as being in an error state. But if update_my_handlers is unable to open the process of the previous owner, it's likely that something serious has gone wrong, so we continue to make that a fatal error.
This commit is contained in:
		
							parent
							
								
									b0418138fe
								
							
						
					
					
						commit
						d3a01b7ec2
					
				|  | @ -383,11 +383,7 @@ fhandler_fifo::update_my_handlers () | ||||||
|   else |   else | ||||||
|     prev_proc = OpenProcess (PROCESS_DUP_HANDLE, false, prev.winpid); |     prev_proc = OpenProcess (PROCESS_DUP_HANDLE, false, prev.winpid); | ||||||
|   if (!prev_proc) |   if (!prev_proc) | ||||||
|     { |     api_fatal ("Can't open process of previous owner, %E"); | ||||||
|       debug_printf ("Can't open process of previous owner, %E"); |  | ||||||
|       __seterrno (); |  | ||||||
|       goto out; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|   for (int i = 0; i < get_shared_nhandlers (); i++) |   for (int i = 0; i < get_shared_nhandlers (); i++) | ||||||
|     { |     { | ||||||
|  | @ -399,14 +395,17 @@ fhandler_fifo::update_my_handlers () | ||||||
| 			    !close_on_exec (), DUPLICATE_SAME_ACCESS)) | 			    !close_on_exec (), DUPLICATE_SAME_ACCESS)) | ||||||
| 	{ | 	{ | ||||||
| 	  debug_printf ("Can't duplicate handle of previous owner, %E"); | 	  debug_printf ("Can't duplicate handle of previous owner, %E"); | ||||||
| 	  --nhandlers; |  | ||||||
| 	  __seterrno (); | 	  __seterrno (); | ||||||
| 	  goto out; | 	  fc.state = fc_error; | ||||||
|  | 	  fc.last_read = false; | ||||||
|  | 	  ret = -1; | ||||||
|  | 	} | ||||||
|  |       else | ||||||
|  | 	{ | ||||||
|  | 	  fc.state = shared_fc_handler[i].state; | ||||||
|  | 	  fc.last_read = shared_fc_handler[i].last_read; | ||||||
| 	} | 	} | ||||||
|       fc.state = shared_fc_handler[i].state; |  | ||||||
|       fc.last_read = shared_fc_handler[i].last_read; |  | ||||||
|     } |     } | ||||||
| out: |  | ||||||
|   set_prev_owner (null_fr_id); |   set_prev_owner (null_fr_id); | ||||||
|   return ret; |   return ret; | ||||||
| } | } | ||||||
|  | @ -493,7 +492,7 @@ fhandler_fifo::fifo_reader_thread_func () | ||||||
| 	      set_owner (me); | 	      set_owner (me); | ||||||
| 	      set_pending_owner (null_fr_id); | 	      set_pending_owner (null_fr_id); | ||||||
| 	      if (update_my_handlers () < 0) | 	      if (update_my_handlers () < 0) | ||||||
| 		api_fatal ("Can't update my handlers, %E"); | 		debug_printf ("error updating my handlers, %E"); | ||||||
| 	      owner_found (); | 	      owner_found (); | ||||||
| 	      owner_unlock (); | 	      owner_unlock (); | ||||||
| 	      /* Fall through to owner_listen. */ | 	      /* Fall through to owner_listen. */ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue