Skip to content

Commit

Permalink
refactor: remove unnecessary os.ModeNamedPipe
Browse files Browse the repository at this point in the history
Signed-off-by: thediveo <thediveo@gmx.eu>
  • Loading branch information
thediveo committed Dec 18, 2023
1 parent 7fa651f commit 34f7938
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion capturestream.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
func Capture(st csharg.SharkTank) int {
// Open packet stream pipe to Wireshark to feed it jucy packets...
log.Debugf("fifo to Wireshark %s", wireshark.FifoPath)
fifo, err := os.OpenFile(wireshark.FifoPath, os.O_WRONLY, os.ModeNamedPipe)
fifo, err := os.OpenFile(wireshark.FifoPath, os.O_WRONLY, 0)
if err != nil {
log.Errorf("cannot open fifo: %s", err.Error())
return 1
Expand Down
9 changes: 5 additions & 4 deletions pipe/checker_notwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import (
"os"
"time"

"golang.org/x/sys/unix"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/thediveo/success"
"golang.org/x/sys/unix"
)

var _ = Describe("pipes", func() {
Expand All @@ -32,13 +33,13 @@ var _ = Describe("pipes", func() {
wch := make(chan *os.File)
go func() {
defer GinkgoRecover()
wch <- Successful(os.OpenFile(fifoname, os.O_WRONLY, os.ModeNamedPipe))
wch <- Successful(os.OpenFile(fifoname, os.O_WRONLY, 0))
}()

rch := make(chan *os.File)
go func() {
defer GinkgoRecover()
rch <- Successful(os.OpenFile(fifoname, os.O_RDONLY, os.ModeNamedPipe))
rch <- Successful(os.OpenFile(fifoname, os.O_RDONLY, 0))
}()

var r, w *os.File
Expand Down Expand Up @@ -73,7 +74,7 @@ var _ = Describe("pipes", func() {
start := time.Now()
WaitTillBreak(w)
Expect(time.Since(start).Milliseconds()).To(
BeNumerically(">", 1900), "pipe wasn't broken yet")
BeNumerically(">", 1900), "false positive: pipe wasn't broken yet")
})

})

0 comments on commit 34f7938

Please # to comment.