From 753c0f76faca4b3682b7d0a48b584e8544855153 Mon Sep 17 00:00:00 2001 From: yahavi Date: Thu, 18 Jul 2024 18:48:31 +0300 Subject: [PATCH] Add the create error to the chmod error --- io/fileutils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/fileutils.go b/io/fileutils.go index e721081..53b4776 100644 --- a/io/fileutils.go +++ b/io/fileutils.go @@ -365,8 +365,8 @@ func createFileForWriting(destPath string) (*os.File, error) { } log.Debug(fmt.Sprintf("Couldn't to open the destination file: '%s' due to %s. Attempting to set the file permissions to read-write.", destPath, err.Error())) - if err = os.Chmod(destPath, 0600); err != nil { - return nil, err + if chmodErr := os.Chmod(destPath, 0600); chmodErr != nil { + return nil, errors.Join(err, chmodErr) } // Try to open the destination file again