/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2020 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
fd, err := TempFile(jobsPath, "")
if err == nil {
- ctx.LogD("tmp", SDS{"src": fd.Name()}, "created")
+ ctx.LogD("tmp", LEs{{"Src", fd.Name()}}, "created")
}
return fd, err
}
}
func (tmp *TmpFileWHash) Cancel() {
- tmp.Fd.Truncate(0) // #nosec G104
- tmp.Fd.Close() // #nosec G104
+ tmp.Fd.Truncate(0) // #nosec G104
+ tmp.Fd.Close() // #nosec G104
os.Remove(tmp.Fd.Name()) // #nosec G104
}
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")
+ tmp.ctx.LogD("tmp", LEs{{"Src", tmp.Fd.Name()}, {"Dst", checksum}}, "commit")
if err = os.Rename(tmp.Fd.Name(), filepath.Join(dir, checksum)); err != nil {
return err
}