tests: don't crash on empty Flistxattr result
This commit is contained in:
parent
735e2aa65b
commit
fd0e8aa869
|
@ -42,7 +42,10 @@ func TestFdXattr(t *testing.T) {
|
||||||
if sz != expectedSz {
|
if sz != expectedSz {
|
||||||
t.Errorf("expected size %d, got %d", expectedSz, sz)
|
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 {
|
if str != attr {
|
||||||
t.Errorf("expected name %q, got %q", attr, str)
|
t.Errorf("expected name %q, got %q", attr, str)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue