mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	skip null bytes at the end of strings
Signed-off-by: ston1th <ston1th@giftfish.de>
This commit is contained in:
		
							parent
							
								
									26bd6bf99d
								
							
						
					
					
						commit
						bdba65df16
					
				| 
						 | 
				
			
			@ -20,11 +20,15 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
func int8ToString(a []int8) string {
 | 
			
		||||
	b := make([]byte, len(a))
 | 
			
		||||
	buf := make([]byte, len(a))
 | 
			
		||||
	for i, v := range a {
 | 
			
		||||
		b[i] = byte(v)
 | 
			
		||||
		if byte(v) == 0 {
 | 
			
		||||
			buf = buf[:i]
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		buf[i] = byte(v)
 | 
			
		||||
	}
 | 
			
		||||
	return string(b)
 | 
			
		||||
	return string(buf)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// unix._C_int
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue