close files opened during migration (#10956)
Andrew Gillis committed
Sep 8, 2025 at 10:20 UTC
6faa9d85bf403fd768bdb0b008cfccbb06df3486
2 files changed
+3
cmd/ipfs/kubo/add_migrations.go
+2
@@ -83,10 +83,12 @@ func addMigrationFiles(ctx context.Context, node *core.IpfsNode, paths []string,
83
84
fi, err := f.Stat()
85
if err != nil {
86
+ f.Close()
87
return err
88
}
89
90
ipfsPath, err := ufs.Add(ctx, files.NewReaderStatFile(f, fi), options.Unixfs.Pin(pin, ""))
91
+ f.Close()
92
if err != nil {
93
return err
94
}
repo/fsrepo/fsrepo.go
+1
@@ -393,6 +393,7 @@ func (r *FSRepo) SetAPIAddr(addr ma.Multiaddr) error {
393
}
394
395
if _, err = f.WriteString(addr.String()); err != nil {
396
+ f.Close()
397
return err
398
}
399
if err = f.Close(); err != nil {