Skip to content

Commit

Permalink
Merge pull request #23 from alexflint/revert-17-file-permissions
Browse files Browse the repository at this point in the history
Revert "feat: add an option to configure lock file permissions"
  • Loading branch information
alexflint authored Jan 11, 2024
2 parents 27556bd + 2e3702a commit d273d2a
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions filemutex_flock.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris

package filemutex

import (
"os"

"golang.org/x/sys/unix"
)
import "golang.org/x/sys/unix"

const (
mkdirPerm os.FileMode = 0750
mkdirPerm = 0750
)

// FileMutex is similar to sync.RWMutex, but also synchronizes across processes.
Expand All @@ -24,15 +19,7 @@ type FileMutex struct {
}

func New(filename string) (*FileMutex, error) {
return new(filename, mkdirPerm)
}

func NewWithMode(filename string, perm os.FileMode) (*FileMutex, error) {
return new(filename, perm)
}

func new(filename string, perm os.FileMode) (*FileMutex, error) {
fd, err := unix.Open(filename, unix.O_CREAT|unix.O_RDONLY, uint32(perm))
fd, err := unix.Open(filename, unix.O_CREAT|unix.O_RDONLY, mkdirPerm)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d273d2a

Please sign in to comment.