path: root/src/basic/exec-util.c
Commit message (Collapse)AuthorAge
* exec-util: errors are reported by non-zero, not negative by putenv()Lennart Poettering2018-10-29
| | | | (cherry picked from commit 8f7329ac276306dfaf6cc47920f3c5e71a0ab586)
* exec-util: add missing logging callLennart Poettering2018-10-29
| | | | | | | This function logs about all errors, but one case was forgotten. Fix that. (cherry picked from commit 653d469519f78d3931c0bc9fe5597d18454bef3d)
* exec-util: handle putenv() errorsLennart Poettering2018-10-29
| | | | | | | | | Just paranoia, as putenv() can fail and we should catch it, like we catch all other errors. Follow-up for #10073 (cherry picked from commit ed689f7894e56024a11bd02327b2bdfce5636dfd)
* exec-util: in execute_directories, support initial exec environmentDimitri John Ledkov2018-10-29
| | | | (cherry picked from commit 78ec1bb436fb18df3b56212c442cc4775a136d1a)
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-08-24
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* conf-files: beef up conf-files.[ch] a bitLennart Poettering2018-08-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds fozr new flags: - If CONF_FILES_DIRECTORY is specified conf_file_list() and friends will look for directories only. - Similar CONF_FILES_REGULAR means we'll look only for regular files. - If CONF_FILES_BASENAME is specified the resulting list will contain only the basenames of all discovered files or directories, not the full paths. - If CONF_FILES_FILTER_MASKED is specified the resulting list will have masked entries removed (i.e. those symlinked to /dev/null and suchlike) These four flags are useful for discovering portable service profile information. While we are at it, also improve a couple of other things: - More debug logging - use path_hash_ops instead of string_hash_ops when putting together the path lists
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* coccinelle: make use of DIV_ROUND_UP() wherever appropriateLennart Poettering2018-08-24
| | | | Let's use our macros where we can
* tree-wide: port various places over to use new rearrange_stdio()Lennart Poettering2018-05-30
* basic/exec-util: use _exit() to return from childZbigniew Jędrzejewski-Szmek2018-05-30
* exec-util: cast to void when return value is ignoredYu Watanabe2018-05-30
| | | | CID 1384262.
* process-spec: add another flag FORK_WAIT to safe_fork()Lennart Poettering2018-05-30
| | | | | | | | | This new flag will cause safe_fork() to wait for the forked off child before returning. This allows us to unify a number of cases where we immediately wait on the forked off child, witout running any code in the parent after the fork, and without direct interest in the precise exit status of the process, except recgonizing EXIT_SUCCESS vs everything else.
* exec-util: drop redundant log message in do_spawn()Lennart Poettering2018-05-30
| | | | safe_fork() logs that anyway, hence no need to do this twice.
* process-util: rework wait_for_terminate_and_warn() to take a flags parameterLennart Poettering2018-05-30
| | | | | | | | | | | | | This renames wait_for_terminate_and_warn() to wait_for_terminate_and_check(), and adds a flags parameter, that controls how much to log: there's one flag that means we log about abnormal stuff, and another one that controls whether we log about non-zero exit codes. Finally, there's a shortcut flag value for logging in both cases, as that's what we usually use. All callers are accordingly updated. At three occasions duplicate logging is removed, i.e. where the old function was called but logged in the caller, too.
* process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN loggingLennart Poettering2018-05-30
* tree-wide: introduce new safe_fork() helper and port everything overLennart Poettering2018-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new safe_fork() wrapper around fork() and makes use of it everywhere. The new wrapper does a couple of things we previously did manually and separately in a safer, more correct and automatic way: 1. Optionally resets signal handlers/mask in the child 2. Sets a name on all processes we fork off right after forking off (and the patch assigns useful names for all processes we fork off now, following a systematic naming scheme: always enclosed in () – in order to indicate that these are not proper, exec()ed processes, but only forked off children, and if the process is long-running with only our own code, without execve()'ing something else, it gets am "sd-" prefix.) 3. Optionally closes all file descriptors in the child 4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe way so that the parent dying before this happens being handled safely. 5. Optionally reopens the logs 6. Optionally connects stdin/stdout/stderr to /dev/null 7. Debug logs about the forked off processes.
* Prep v236 : Add missing SPDX-License-Identifier (2/9) src/basicSven Eden2018-03-26
* exec-util: initialize `new` before using it (#7471)Evgeny Vereshchagin2017-11-26
| | | | CID #1383004
* basic/exec-utils:do_execute() : Remove "maybe unitialized" warningSven Eden2017-12-11
* exec-util,conf-files: skip non-executable files in execute_directories()Lennart Poettering2017-09-25
| | | | Fixes: #6787
* Prep v233.2: Mask unneeded functions and definitions in src/basicSven Eden2017-07-18
* Prep v233: Add missing files from upstream and rename formats-util.[hc]Sven Eden2017-07-17
Some functionality has been exported to the following files: - src/basic/env-util.[hc] - src/basic/exec-util.[hc] - src/shared/nsflags.[hc] The content of these files is now needed in elogind, and the files have been added as-is. Cleanup is done later. Further the header src/basic/formats-util.h has been renamed to src/basic/format-util.h