Fix noinlineerr findings: internal/vaultik (refs #61)

This commit is contained in:
2026-08-07 16:59:56 +00:00
parent 919229f224
commit e7b49d58ab
10 changed files with 123 additions and 56 deletions
+13 -6
View File
@@ -483,14 +483,16 @@ func (v *Vaultik) downloadSnapshotDB(snapshotID string, identity age.Identity) (
tempPath := tempFile.Name()
// Write the binary SQLite database directly
if _, err := tempFile.Write(dbData); err != nil {
_, err = tempFile.Write(dbData)
if err != nil {
_ = tempFile.Close()
_ = v.Fs.Remove(tempPath)
return nil, fmt.Errorf("writing database file: %w", err)
}
if err := tempFile.Close(); err != nil {
err = tempFile.Close()
if err != nil {
_ = v.Fs.Remove(tempPath)
return nil, fmt.Errorf("closing temp file: %w", err)
@@ -559,7 +561,9 @@ func (v *Vaultik) buildChunkToBlobMap(ctx context.Context, repos *database.Repos
bc database.BlobChunk
blobIDStr, chunkHashStr string
)
if err := rows.Scan(&blobIDStr, &chunkHashStr, &bc.Offset, &bc.Length); err != nil {
err = rows.Scan(&blobIDStr, &chunkHashStr, &bc.Offset, &bc.Length)
if err != nil {
return nil, fmt.Errorf("scanning blob_chunk: %w", err)
}
@@ -762,11 +766,13 @@ func (s *restoreSession) restoreRegularFile(file *database.File, targetPath stri
"ms_sweeper", sweeperDur.Milliseconds(),
)
if err := outFile.Close(); err != nil {
err = outFile.Close()
if err != nil {
return fmt.Errorf("closing output file: %w", err)
}
if err := s.v.Fs.Chmod(targetPath, os.FileMode(file.Mode)); err != nil {
err = s.v.Fs.Chmod(targetPath, os.FileMode(file.Mode))
if err != nil {
log.Debug("Failed to set file permissions", "path", targetPath, "error", err)
}
@@ -779,7 +785,8 @@ func (s *restoreSession) restoreRegularFile(file *database.File, targetPath stri
}
}
if err := s.v.Fs.Chtimes(targetPath, file.MTime, file.MTime); err != nil {
err = s.v.Fs.Chtimes(targetPath, file.MTime, file.MTime)
if err != nil {
log.Debug("Failed to set file mtime", "path", targetPath, "error", err)
}