diff options
author | Jakob Unterwurzacher | 2020-07-12 13:40:21 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2020-07-12 13:40:21 +0200 |
commit | fd0e8aa869ec74917d669d42f0e0d3b2888237b9 (patch) | |
tree | 798d9dadfcb8e06ef8a47e2660295aea33e37fb2 /tests | |
parent | 735e2aa65b25e24743c4a60f763633bcba982b72 (diff) |
tests: don't crash on empty Flistxattr result
Diffstat (limited to 'tests')
-rw-r--r-- | tests/xattr/xattr_fd_test.go | 5 |
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) } |