Merge pull request #6919 from tstromberg/test-panic

none_test: Fix nil pointer dereference on stat error
pull/6924/head
Medya Ghazizadeh 2020-03-06 13:40:48 -08:00 committed by GitHub
commit 987964bbb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,11 @@ func TestChangeNoneUser(t *testing.T) {
info, err := os.Stat(p)
if err != nil {
t.Errorf("stat(%s): %v", p, err)
continue
}
if info == nil || info.Sys() == nil {
t.Errorf("nil info for %s", p)
continue
}
got := info.Sys().(*syscall.Stat_t).Uid
if got != uint32(uid) {