From 1894123d3c7ae783e00b886ff57b53858e29c015 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Thu, 18 Jul 2019 20:49:00 +0200 Subject: [PATCH] lib/syncthing: Modify exit status before stopping (fixes #5869) (#5870) --- lib/syncthing/syncthing.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/syncthing/syncthing.go b/lib/syncthing/syncthing.go index dd66cd168..bfdadd8eb 100644 --- a/lib/syncthing/syncthing.go +++ b/lib/syncthing/syncthing.go @@ -407,13 +407,13 @@ func (a *App) Stop(stopReason ExitStatus) ExitStatus { case <-a.stopped: case <-a.stop: default: + // ExitSuccess is the default value for a.exitStatus. If another status + // was already set, ignore the stop reason given as argument to Stop. + if a.exitStatus == ExitSuccess { + a.exitStatus = stopReason + } close(a.stop) - } - <-a.stopped - // ExitSuccess is the default value for a.exitStatus. If another status - // was already set, ignore the stop reason given as argument to Stop. - if a.exitStatus == ExitSuccess { - a.exitStatus = stopReason + <-a.stopped } return a.exitStatus }