Log an error when calculating the binary checksum failed (#20454)

This commit is contained in:
Ramon de Klein 2024-09-19 05:48:32 +02:00 committed by GitHub
parent 48a591e9b4
commit e1c2344591
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,10 +184,13 @@ var binaryChecksum = getBinaryChecksum()
func getBinaryChecksum() string { func getBinaryChecksum() string {
mw := md5.New() mw := md5.New()
b, err := os.Open(os.Args[0]) b, err := os.Open(os.Args[0])
if err == nil { if err != nil {
defer b.Close() logger.Error("Calculating checksum failed: %s", err)
io.Copy(mw, b) return "00000000000000000000000000000000"
} }
defer b.Close()
io.Copy(mw, b)
return hex.EncodeToString(mw.Sum(nil)) return hex.EncodeToString(mw.Sum(nil))
} }