From 6c6b0e2395934ce0d0c01074e53007ce41538e86 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Aug 2016 18:39:17 +0200 Subject: [PATCH] cat: Add warning when pack was modified --- src/cmds/restic/cmd_cat.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmds/restic/cmd_cat.go b/src/cmds/restic/cmd_cat.go index 58e5dc452..f4e7eafec 100644 --- a/src/cmds/restic/cmd_cat.go +++ b/src/cmds/restic/cmd_cat.go @@ -157,6 +157,11 @@ func (cmd CmdCat) Execute(args []string) error { return err } + hash := backend.Hash(buf) + if !hash.Equal(id) { + fmt.Fprintf(cmd.global.stderr, "Warning: hash of data does not match ID, want\n %v\ngot:\n %v\n", id.String(), hash.String()) + } + _, err = os.Stdout.Write(buf) return err