diff options
-rw-r--r-- | misc/open_file.go | 14 | ||||
-rw-r--r-- | scfg/writer.go | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/misc/open_file.go b/misc/open_file.go index ec5d402..945d78b 100644 --- a/misc/open_file.go +++ b/misc/open_file.go @@ -1,20 +1,20 @@ package misc import ( - "os" "errors" + "os" + "path" "strings" "syscall" - "path" ) type Dir_t struct { - fd int + fd int name string } var ( - Err_illegal_filename = errors.New("illegal filename") + Err_illegal_filename = errors.New("illegal filename") Err_invalid_file_descriptor = errors.New("invalid file descriptor") ) @@ -29,9 +29,9 @@ func Open_file_at(dir Dir_t, filename string, flags int, perms os.FileMode) (*os // Open a file at or beneath the given directory. func Open_file_beneath(dir Dir_t, filename string, flags int, perms os.FileMode) (*os.File, error) { fd, err := Openat2(dir.fd, filename, &Open_how_t{ - Flags: uint64(flags)|syscall.O_CLOEXEC, - Mode: uint64(syscallMode(perms)), - Resolve: RESOLVE_BENEATH|RESOLVE_NO_SYMLINKS, + Flags: uint64(flags) | syscall.O_CLOEXEC, + Mode: uint64(syscallMode(perms)), + Resolve: RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS, }) if err != nil { return nil, err diff --git a/scfg/writer.go b/scfg/writer.go index 97148a3..dd3b166 100644 --- a/scfg/writer.go +++ b/scfg/writer.go @@ -6,9 +6,7 @@ import ( "strings" ) -var ( - errDirEmptyName = errors.New("scfg: directive with empty name") -) +var errDirEmptyName = errors.New("scfg: directive with empty name") // Write writes a parsed configuration to the provided io.Writer. func Write(w io.Writer, blk Block) error { |