mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	backport of commit 88fb88e3db (#23609)
				
					
				
			Co-authored-by: Peter Wilson <peter.wilson@hashicorp.com>
This commit is contained in:
		 hc-github-team-secure-vault-core
					hc-github-team-secure-vault-core
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							efc95ff3d7
						
					
				
				
					commit
					82642c4683
				
			| @@ -391,27 +391,39 @@ func (b *Backend) open() error { | ||||
| } | ||||
|  | ||||
| func (b *Backend) Reload(_ context.Context) error { | ||||
| 	switch b.path { | ||||
| 	case stdout, discard: | ||||
| 	// When there are nodes created in the map, use the eventlogger behavior. | ||||
| 	if len(b.nodeMap) > 0 { | ||||
| 		for _, n := range b.nodeMap { | ||||
| 			if n.Type() == eventlogger.NodeTypeSink { | ||||
| 				return n.Reopen() | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		return nil | ||||
| 	} | ||||
| 	} else { | ||||
| 		// old non-eventlogger behavior | ||||
| 		switch b.path { | ||||
| 		case stdout, discard: | ||||
| 			return nil | ||||
| 		} | ||||
|  | ||||
| 	b.fileLock.Lock() | ||||
| 	defer b.fileLock.Unlock() | ||||
| 		b.fileLock.Lock() | ||||
| 		defer b.fileLock.Unlock() | ||||
|  | ||||
| 		if b.f == nil { | ||||
| 			return b.open() | ||||
| 		} | ||||
|  | ||||
| 		err := b.f.Close() | ||||
| 		// Set to nil here so that even if we error out, on the next access open() | ||||
| 		// will be tried | ||||
| 		b.f = nil | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
|  | ||||
| 	if b.f == nil { | ||||
| 		return b.open() | ||||
| 	} | ||||
|  | ||||
| 	err := b.f.Close() | ||||
| 	// Set to nil here so that even if we error out, on the next access open() | ||||
| 	// will be tried | ||||
| 	b.f = nil | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	return b.open() | ||||
| } | ||||
|  | ||||
| func (b *Backend) Invalidate(_ context.Context) { | ||||
|   | ||||
							
								
								
									
										3
									
								
								changelog/23598.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/23598.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| ```release-note:bug | ||||
| audit: Fix bug reopening 'file' audit devices on SIGHUP. | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user