aboutsummaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-02-26 22:43:36 +0100
committerJakob Unterwurzacher2017-03-02 19:12:21 +0100
commitb765cc526d3881f7b655200823c5ca72c03548bc (patch)
tree75d6081b1b09efd35873e26b3ef8b73c812884c0 /mount.go
parentc304626a475cbedbafea0c2f1a1d1b9cfef9bdde (diff)
main: get rid of third open paniclog fd
We have it saved in Stderr and Stdout anyway, let's free this fd number.
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/mount.go b/mount.go
index 7845063..8709124 100644
--- a/mount.go
+++ b/mount.go
@@ -134,6 +134,8 @@ func doMount(args *argContainer) int {
// https://github.com/golang/go/issues/325#issuecomment-66049178
syscall.Dup2(int(paniclog.Fd()), 1)
syscall.Dup2(int(paniclog.Fd()), 2)
+ // No need for the extra FD anymore, we have it saved in Stderr
+ paniclog.Close()
}
// Disconnect from the controlling terminal by creating a new session.
// This prevents us from getting SIGINT when the user presses Ctrl-C
@@ -153,7 +155,8 @@ func doMount(args *argContainer) int {
srv.Serve()
// Delete empty paniclogs
if paniclog != nil {
- fi, err := paniclog.Stat()
+ // The paniclog FD is saved in Stderr
+ fi, err := os.Stderr.Stat()
if err != nil {
tlog.Warn.Printf("paniclog fstat error: %v", err)
} else if fi.Size() > 0 {