empty check

This commit is contained in:
James Cor
2022-05-18 13:36:22 -07:00
parent 57f2a3f163
commit e9ada8a99e
@@ -88,7 +88,16 @@ func LoadData() ([]byte, error) {
fileMutex.Lock()
defer fileMutex.Unlock()
return ioutil.ReadFile(mysqlDbFilePath)
buf, err := ioutil.ReadFile(mysqlDbFilePath)
if err != nil && !errors.Is(err, os.ErrNotExist) {
return nil, err
}
if len(buf) == 0 {
return nil, nil
}
return buf, nil
}
var _ mysql_db.PrivilegePersistCallback = SavePrivileges