summaryrefslogtreecommitdiffstats
path: root/src/shared/main-func.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: check argc/argv uncoditionallyFrantisek Sumsal2022-01-311-1/+1
| | | | | | as `assert()` might be dropped with `-DNDEBUG`. Follow-up to cf3095a and 1637e75.
* shared: be extra paranoid and check if argc > 0Frantisek Sumsal2022-01-301-0/+1
| | | | | and also if argv[0] is non-empty as a precaution for issues similar to CVE-2021-4034.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* main-func: send main exit code to parent via sd_notify() on exitLennart Poettering2019-12-041-0/+4
| | | | | | | | | So far we silently convert negative return values from run() as EXIT_FAILURE, which is how UNIX expects it. In many cases it would be very useful for the caller to retrieve the actual error number we exit with. Let's generically return that via sd_notify()'s ERRNO= attribute. This means callers can set $NOTIFY_SOCKET and get the actual error number delivered at their doorstep just like that.
* codespell: fix spelling errorsBen Boeckel2019-04-291-1/+1
|
* main-func: make sure we destruct memory and stuff lastLennart Poettering2019-03-211-2/+2
| | | | Let's terminate pagers and agents before releasing all memory.
* main-func: implicitly save argc/argv in DEFINE_MAIN_FUNCTION() functionsLennart Poettering2019-03-211-0/+2
| | | | | Let's remove the risk of forgetting to save argc/argv if DEFINE_MAIN_FUNCTION() is used.
* generators: define custom main func definer and use it where applicableZbigniew Jędrzejewski-Szmek2018-12-121-4/+5
| | | | | | | | | | There should be no functional difference, except that the error message is changd from "three or no arguments" to "zero or three arguments". Somehow the inverted form always seemed strange. umask() call is also dropped from run-generator. I think it wasn't dropped in 053254e3cb215df3b8c905bc39b920f8817e1c7d because the run generator was merged around the same time.
* Call mac_selinux_close() from main func macros, convert user-sessions and ↵Zbigniew Jędrzejewski-Szmek2018-11-211-0/+2
| | | | test-udev
* systemctl: define main through macro and call ask_password_agent_close() ↵Zbigniew Jędrzejewski-Szmek2018-11-211-0/+2
| | | | | | from the macro This doesn't save us anything, but I like consistency.
* shared/main-func: also close the polkit agent automaticallyZbigniew Jędrzejewski-Szmek2018-11-201-0/+2
| | | | | | The agent is closed after the static destuctors but before the pager. No users of DEFINE_MAIN_FUNCTION* were using a polkit agent, so this makes no functional difference.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-0/+27
This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).