tests: don't crash on empty Flistxattr result

This commit is contained in:
Jakob Unterwurzacher 2020-07-12 13:40:21 +02:00
parent 735e2aa65b
commit fd0e8aa869
1 changed files with 4 additions and 1 deletions

View File

@ -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)
}