Clixon_backend now returns -1/255 on error instead of 0

This commit is contained in:
Olof Hagsand 2017-12-12 22:40:28 +01:00
parent dd7f790193
commit ca16007b66
2 changed files with 7 additions and 2 deletions

View file

@ -2,7 +2,10 @@
## 3.4.0 (Upcoming) ## 3.4.0 (Upcoming)
* Clixon_backend now returns -1/255 on error instead of NULL. Useful for systemd restarts, for example.
* Fixed bug that deletes running on startup if backup started with -m running. * Fixed bug that deletes running on startup if backup started with -m running.
When clixon starts again, running is lost.
The error was that the running (or startup) configuration may fail when The error was that the running (or startup) configuration may fail when
clixon backend starts. clixon backend starts.
The fix now makes a copy of running and copies it back on failure. The fix now makes a copy of running and copies it back on failure.

View file

@ -642,6 +642,7 @@ startup_mode_startup(clicon_handle h,
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int retval = -1;
char c; char c;
int zap; int zap;
int foreground; int foreground;
@ -965,9 +966,10 @@ main(int argc, char **argv)
if (event_loop() < 0) if (event_loop() < 0)
goto done; goto done;
retval = 0;
done: done:
clicon_log(LOG_NOTICE, "%s: %u Terminated", __PROGRAM__, getpid()); clicon_log(LOG_NOTICE, "%s: %u Terminated retval:%d", __PROGRAM__, getpid(), retval);
backend_terminate(h); /* Cannot use h after this */ backend_terminate(h); /* Cannot use h after this */
return 0; return retval;
} }