Skip to content

Commit 45ab0e9

Browse files
committed
pkg/updater: fix autoupdate
Start update goroutine even in the case of early returns in UpdateOnStart. Fixes #6619
1 parent 20d37d2 commit 45ab0e9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pkg/updater/updater.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ func New(cfg *Config) (*Updater, error) {
125125
// - ensures that the current executable is fresh
126126
// - ensures that we have a working syzkaller build in current
127127
func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan struct{}) {
128+
if autoupdate {
129+
defer func() {
130+
go func() {
131+
upd.waitForUpdate()
132+
close(updatePending)
133+
}()
134+
}()
135+
}
136+
128137
os.RemoveAll(upd.currentDir)
129138
latestTag := upd.checkLatest()
130139
if latestTag != "" {
@@ -180,12 +189,6 @@ func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan
180189
os.Exit(0)
181190
}
182191
}
183-
if autoupdate {
184-
go func() {
185-
upd.waitForUpdate()
186-
close(updatePending)
187-
}()
188-
}
189192
}
190193

191194
// waitForUpdate polls and rebuilds syzkaller.

0 commit comments

Comments
 (0)