]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/tmp.go
More errors checking
[nncp.git] / src / tmp.go
index 91850d746566bdd5d4603db85776932a9ea1a3e9..62ec5bbc9cbdd4d253858666c850168595ab3ba9 100644 (file)
@@ -105,7 +105,9 @@ func (tmp *TmpFileWHash) Commit(dir string) error {
                tmp.Fd.Close() // #nosec G104
                return err
        }
-       tmp.Fd.Close()
+       if err = tmp.Fd.Close(); err != nil {
+               return err
+       }
        checksum := Base32Codec.EncodeToString(tmp.Hsh.Sum(nil))
        tmp.ctx.LogD("tmp", SDS{"src": tmp.Fd.Name(), "dst": checksum}, "commit")
        if err = os.Rename(tmp.Fd.Name(), filepath.Join(dir, checksum)); err != nil {