|
|
3aa8f6 |
From 44f6033c48968945353109af69114b5d0a1700de Mon Sep 17 00:00:00 2001
|
|
|
3aa8f6 |
From: Jhon Honce <jhonce@redhat.com>
|
|
|
3aa8f6 |
Date: Fri, 11 Oct 2019 16:08:59 -0700
|
|
|
3aa8f6 |
Subject: [PATCH] Check for both nil and zero length
|
|
|
3aa8f6 |
|
|
|
3aa8f6 |
Signed-off-by: Jhon Honce <jhonce@redhat.com>
|
|
|
3aa8f6 |
---
|
|
|
3aa8f6 |
libcontainer/generic_error.go | 4 ++++
|
|
|
3aa8f6 |
1 file changed, 4 insertions(+)
|
|
|
3aa8f6 |
|
|
|
3aa8f6 |
diff --git a/libcontainer/generic_error.go b/libcontainer/generic_error.go
|
|
|
3aa8f6 |
index de37715c..0f90369b 100644
|
|
|
3aa8f6 |
--- a/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/generic_error.go
|
|
|
3aa8f6 |
+++ b/runc-66aedde759f33c190954815fb765eedc1d782dd9/libcontainer/generic_error.go
|
|
|
3aa8f6 |
@@ -93,6 +93,10 @@ func (e *genericError) Error() string {
|
|
|
3aa8f6 |
if e.Cause == "" {
|
|
|
3aa8f6 |
return e.Message
|
|
|
3aa8f6 |
}
|
|
|
3aa8f6 |
+
|
|
|
3aa8f6 |
+ if len(e.Stack.Frames) == 0 {
|
|
|
3aa8f6 |
+ return fmt.Sprintf("<unknown>:<unknown>: %s caused %q", e.Cause, e.Message)
|
|
|
3aa8f6 |
+ }
|
|
|
3aa8f6 |
frame := e.Stack.Frames[0]
|
|
|
3aa8f6 |
return fmt.Sprintf("%s:%d: %s caused %q", frame.File, frame.Line, e.Cause, e.Message)
|
|
|
3aa8f6 |
}
|