mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-11-04 21:46:39 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			15 lines
		
	
	
		
			341 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			341 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package common
 | 
						|
 | 
						|
import (
 | 
						|
	"os"
 | 
						|
	"syscall"
 | 
						|
)
 | 
						|
 | 
						|
func SafeOsOpenFile(path string, flag int, perm os.FileMode) (*os.File, error) {
 | 
						|
	if err := safePath(path); err != nil {
 | 
						|
		Log.Debug("common::files safeOsOpenFile err[%s] path[%s]", err.Error(), path)
 | 
						|
		return nil, ErrFilesystemError
 | 
						|
	}
 | 
						|
	return os.OpenFile(path, flag|syscall.O_NOFOLLOW, perm)
 | 
						|
}
 |