[Piuparts-commits] [piuparts] 01/01: piuparts-distill: correctly handle errors

Holger Levsen holger at layer-acht.org
Tue Sep 19 14:00:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit b839cbe68010b4f5fad6da639e4bc9e74530ff1e
Author: Michael Stapelberg <stapelberg at debian.org>
Date:   Tue Sep 19 15:06:20 2017 +0200

    piuparts-distill: correctly handle errors
    
    Also, as defense in depth, verify info is non-nil before accessing it.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 helpers/debiman-piuparts-distill/piuparts.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/helpers/debiman-piuparts-distill/piuparts.go b/helpers/debiman-piuparts-distill/piuparts.go
index 498b564..b977b45 100644
--- a/helpers/debiman-piuparts-distill/piuparts.go
+++ b/helpers/debiman-piuparts-distill/piuparts.go
@@ -123,7 +123,10 @@ func main() {
 	}()
 	// Walk through *logsDir, enqueue all .log files onto the work channel
 	if err := filepath.Walk(*logsDir, func(path string, info os.FileInfo, err error) error {
-		if strings.HasSuffix(path, ".log") && info.Mode().IsRegular() {
+		if err != nil {
+			return err
+		}
+		if strings.HasSuffix(path, ".log") && info != nil && info.Mode().IsRegular() {
 			work <- path
 		}
 		return nil

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list