mirror of https://github.com/containers/podman.git
				
				
				
			cp: close temporary file on error path
follow-up for https://github.com/containers/podman/pull/19526 on io.Copy() errors make sure the temporary file is closed. [NO NEW TESTS NEEDED] Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
		
							parent
							
								
									c04ead152e
								
							
						
					
					
						commit
						39641482c1
					
				|  | @ -386,6 +386,7 @@ func copyToContainer(container string, containerPath string, hostPath string) er | ||||||
| 
 | 
 | ||||||
| 		_, err = io.Copy(tmpFile, os.Stdin) | 		_, err = io.Copy(tmpFile, os.Stdin) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|  | 			_ = tmpFile.Close() | ||||||
| 			return err | 			return err | ||||||
| 		} | 		} | ||||||
| 		if err = tmpFile.Close(); err != nil { | 		if err = tmpFile.Close(); err != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue