summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}