aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-12 13:40:21 +0200
committerJakob Unterwurzacher2020-07-12 13:40:21 +0200
commitfd0e8aa869ec74917d669d42f0e0d3b2888237b9 (patch)
tree798d9dadfcb8e06ef8a47e2660295aea33e37fb2
parent735e2aa65b25e24743c4a60f763633bcba982b72 (diff)
tests: don't crash on empty Flistxattr result
-rw-r--r--tests/xattr/xattr_fd_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/xattr/xattr_fd_test.go b/tests/xattr/xattr_fd_test.go
index ad0b7ed..d3f02c5 100644
--- a/tests/xattr/xattr_fd_test.go
+++ b/tests/xattr/xattr_fd_test.go
@@ -42,7 +42,10 @@ func TestFdXattr(t *testing.T) {
if sz != expectedSz {
t.Errorf("expected size %d, got %d", expectedSz, sz)
}
- str := string(buf[:sz-1])
+ str := ""
+ if sz > 0 {
+ str = string(buf[:sz-1])
+ }
if str != attr {
t.Errorf("expected name %q, got %q", attr, str)
}