syz-manager: remove duplicated emails on restart

With commit: syz-manager: add simple email support, it will send
emails when a bug is hit for the first time during that particular
run of syz-manager. In other words, if you restart syz-manager and
the same bug is hit, a new email will be sent again. This is due to
the fact that mgr.crashTypes[crash.Title] doesn't keep track of logs
already written to the disk.

Fixed by moving emailCrash() to logic handling log writing.

Fixes #484

Signed-off-by: Tim Tianyang Chen <soapcn@gmail.com>
This commit is contained in:
Tim Tianyang Chen 2017-12-19 15:43:48 -08:00 committed by Dmitry Vyukov
parent 90a46995a8
commit 49bed8cf4d

View File

@ -615,7 +615,6 @@ func (mgr *Manager) saveCrash(crash *Crash) bool {
if !mgr.crashTypes[crash.Title] {
mgr.crashTypes[crash.Title] = true
mgr.stats["crash types"]++
go mgr.emailCrash(crash)
}
mgr.mu.Unlock()
@ -654,6 +653,9 @@ func (mgr *Manager) saveCrash(crash *Crash) bool {
info, err := os.Stat(filepath.Join(dir, fmt.Sprintf("log%v", i)))
if err != nil {
oldestI = i
if i == 0 {
go mgr.emailCrash(crash)
}
break
}
if oldestTime.IsZero() || info.ModTime().Before(oldestTime) {