Change unauthorized-api exit code to 3 (Issue #567) (#572)

* Changes unauthorized-api exit code to 3
* Systemd will not restart on exit code 3
This commit is contained in:
Matthew Fallon 2019-07-05 17:01:04 -05:00 committed by abraunegg
parent 80675aa8b4
commit f39621c2da
3 changed files with 5 additions and 1 deletions

View file

@ -8,6 +8,7 @@ Wants=network-online.target
ExecStart=@prefix@/bin/onedrive --monitor
Restart=on-failure
RestartSec=3
RestartPreventExitStatus=3
[Install]
WantedBy=default.target

View file

@ -10,6 +10,7 @@ User=%i
Group=users
Restart=on-failure
RestartSec=3
RestartPreventExitStatus=3
[Install]
WantedBy=multi-user.target

View file

@ -10,6 +10,8 @@ static import log;
OneDriveApi oneDrive;
ItemDatabase itemDb;
const int EXIT_UNAUTHORIZED = 3;
enum MONITOR_LOG_SILENT = 2;
enum MONITOR_LOG_QUIET = 1;
enum LOG_NORMAL = 0;
@ -220,7 +222,7 @@ int main(string[] args)
log.error("Could not initialize the OneDrive API");
// workaround for segfault in std.net.curl.Curl.shutdown() on exit
oneDrive.http.shutdown();
return EXIT_FAILURE;
return EXIT_UNAUTHORIZED;
}
// if --synchronize or --monitor not passed in, exit & display help