aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-30 18:24:41 +0800
committerGitHub <noreply@github.com>2017-01-30 18:24:41 +0800
commitf3c368ca736ed2884943cf87b029d305b7fc7c61 (patch)
treeaa70923a4d5d502c7fe0d1ebd0cbafddc0855fc7
parentb8823a8b343cfca94c3ab8f2fc0a7da3d0780bdb (diff)
parent355a42f36d7e27578ecd645c0fc6e07d793b8154 (diff)
downloadgo-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar.gz
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar.bz2
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar.lz
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar.xz
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.tar.zst
go-tangerine-f3c368ca736ed2884943cf87b029d305b7fc7c61.zip
Merge pull request #3624 from kaneshin/patch-01
cmd/geth, cmd/swarm: Fix to close file handler appropriately
-rw-r--r--cmd/geth/chaincmd.go1
-rw-r--r--cmd/swarm/hash.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go
index c77bd554c..f38ee046f 100644
--- a/cmd/geth/chaincmd.go
+++ b/cmd/geth/chaincmd.go
@@ -123,6 +123,7 @@ func initGenesis(ctx *cli.Context) error {
if err != nil {
utils.Fatalf("failed to read genesis file: %v", err)
}
+ defer genesisFile.Close()
block, err := core.WriteGenesisBlock(chaindb, genesisFile)
if err != nil {
diff --git a/cmd/swarm/hash.go b/cmd/swarm/hash.go
index 0a20bea82..bcba77a2a 100644
--- a/cmd/swarm/hash.go
+++ b/cmd/swarm/hash.go
@@ -36,6 +36,7 @@ func hash(ctx *cli.Context) {
fmt.Println("Error opening file " + args[1])
os.Exit(1)
}
+ defer f.Close()
stat, _ := f.Stat()
chunker := storage.NewTreeChunker(storage.NewChunkerParams())