summaryrefslogtreecommitdiff
path: root/src/shared/util.c
Commit message (Collapse)AuthorAge
...
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* kdbus: set kernel attach mask before creating the first busLennart Poettering2014-11-27
|
* util: add function getting proc environJakub Filak2014-11-27
| | | | | On the contrary of env, the added function returns all characters cescaped, because it improves reproducibility.
* util: skip incomplete ucred information in getpeersec()Lennart Poettering2014-11-25
|
* util: add functions getting proc cwd and rootJakub Filak2014-11-21
| | | | | | | /proc/[pid]/cwd and /proc/[pid]/root are symliks to corresponding directories The added functions returns values of that symlinks.
* busctl: add new "call" command to invoke methods on a serviceLennart Poettering2014-11-14
|
* strv: rework strv_split_quoted() to use unquote_first_word()Lennart Poettering2014-11-10
| | | | This should make the unquoting scheme a bit less naive.
* shared: add readlink_valueTom Gundersen2014-11-07
| | | | Reads the basename of the target of a symlink.
* util: simplify normalize_env_assignment() a bitLennart Poettering2014-11-07
|
* util: file_is_priv_sticky() is used internally in util.c only nowadays, make ↵Lennart Poettering2014-11-07
| | | | it static
* util: rework /proc/cmdline parser to use unquote_first_word()Lennart Poettering2014-11-07
|
* util: simplify proc_cmdline() to reuse get_process_cmdline()Lennart Poettering2014-11-07
| | | | Also, make all parsing of the kernel cmdline non-fatal.
* util: make use of isempty() where appropriateLennart Poettering2014-11-07
|
* condition: unify condition logic in one fileLennart Poettering2014-11-06
|
* util: minor modernisationsLennart Poettering2014-11-05
|
* util: unify how we see srand()Lennart Poettering2014-10-30
|
* util: don't block on getrandom()Lennart Poettering2014-10-30
|
* util: make use of the new getrandom() syscall if it is available when ↵Lennart Poettering2014-10-29
| | | | | | | needing entropy Doesn't require an fd, and could be a bit faster, so let's make use of it, if it is available.
* util: fix copy-paste error and actually set the new hostnameMichal Sekletar2014-10-27
| | | | Reported-by: sztanpet on irc
* util: introduce sethostname_idempotentMichal Sekletar2014-10-27
| | | | | Function queries system hostname and applies changes only when necessary. Also, migrate all client of sethostname to sethostname_idempotent while at it.
* label: move is_dir() to util.cLennart Poettering2014-10-23
|
* util: avoid double close of fdThomas Hindoe Paaboel Andersen2014-10-09
| | | | | | | | | | We could end with a double close if we close the fd loop and flush_fd fails. That would make us goto fail and there we close the fd once again. This patch sets the fd to the return value for safe_close: -1 A fd with negative value will be ignored by the next call to safe_close. CID#996223
* shared: util - use nicer idiom to silence CoverityZbigniew Jędrzejewski-Szmek2014-10-01
| | | | Change the other spot too.
* shared: util - use nicer idiom to silence CoverityTom Gundersen2014-09-30
| | | | Suggested by Zbigniew.
* util: silence coverityTom Gundersen2014-09-29
| | | | Make it clear in the code that ignoring a failed safe_ato?() is intentional.
* util: remove a unnecessary checkThomas Hindoe Paaboel Andersen2014-09-16
| | | | | | | We only break out of the previous loop if fd >= 0 so there is no use in checking it again. Found by coverity. Fixes: CID#1237577
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* localed: remove free_and_copyZbigniew Jędrzejewski-Szmek2014-09-03
| | | | It was mostly a duplicate of free_and_strdup().
* util: fix minimal race where we might miss SIGTERMs when forking off an agentLennart Poettering2014-08-27
| | | | | Before forking, block all signals, and unblock them afterwards. This way the child will have them blocked, and we won't lose them.
* util: make lookup_uid() globalDavid Herrmann2014-08-27
| | | | | This is a useful helper, make it global. It will be required for libsystemd-terminal, at minimum.
* util: make use of newly added reset_signal_mask() call wherever appropriateLennart Poettering2014-08-26
|
* util: reset signals when we fork off agentsLennart Poettering2014-08-26
| | | | | | | | | | | If we invoke agents, we should make sure we actually can kill them again. I mean, it's probably not our job to cleanup the signals if our tools are invoked in weird contexts, but at least we should make sure, that the subprocesses we invoke and intend to control work as intended. Also see: http://lists.freedesktop.org/archives/systemd-devel/2014-August/022460.html
* util: make sure reset_all_signal_handlers() continues with all other signal ↵Lennart Poettering2014-08-26
| | | | | | | handlers when one sigaction() fails After all, we usually don't check for failures here, and it is better to do as much as we can...
* core: add support for a configurable system-wide start-up timeoutLennart Poettering2014-08-22
| | | | | | | | | | | | | | | | | | | When this system-wide start-up timeout is hit we execute one of the failure actions already implemented for services that fail. This should not only be useful on embedded devices, but also on laptops which have the power-button reachable when the lid is closed. This devices, when in a backpack might get powered on by accident due to the easily reachable power button. We want to make sure that the system turns itself off if it starts up due this after a while. When the system manages to fully start-up logind will suspend the machine by default if the lid is closed. However, in some cases we don't even get as far as logind, and the boot hangs much earlier, for example because we ask for a LUKS password that nobody ever enters. Yeah, this is a real-life problem on my Yoga 13, which has one of those easily accessible power buttons, even if the device is closed.
* util: simplify close_nointr() a bitLennart Poettering2014-08-21
|
* util: return after freeing all members of arrayLukas Nykryn2014-08-20
|
* indentation/spurious whitespace fixesLennart Poettering2014-08-20
|
* sysusers: add another column to sysusers files for the home directoryLennart Poettering2014-08-19
|
* main: minor code modernization for initializing the consoleLennart Poettering2014-08-15
|
* util: make is_localhost() check for 'localdomain' too, so that we can use it ↵Lennart Poettering2014-08-15
| | | | for both validating domains and host names
* core: Refuse mount on symlinkTimofey Titovets2014-08-15
|
* core: move status line ellipsation to 50% of the lineLennart Poettering2014-08-14
| | | | http://lists.freedesktop.org/archives/systemd-devel/2014-July/021591.html
* fix a couple of more lazy "return -1"Lennart Poettering2014-08-11
| | | | | | Fix should strictly follow the rule to return negative errno-style error codes from functions, hence let's fix more "return -1"-style lazinesses.
* util: avoid considering dpkg temporary files relevant for anythingLennart Poettering2014-08-11
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=82453
* resolved: read the system /etc/resolv.conf unless we wrote it ourselvesLennart Poettering2014-08-01
| | | | | This way we integrate nicely with foreign network management stacks, such as NM.
* core/load-fragment.c: correct argument sign and split up long linesZbigniew Jędrzejewski-Szmek2014-07-31
| | | | With everything on one line they are just harder to read.
* Properly report invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | $ systemd-analyze verify trailing-g.service [./trailing-g.service:2] Trailing garbage, ignoring. trailing-g.service lacks ExecStart setting. Refusing. Error: org.freedesktop.systemd1.LoadFailed: Unit trailing-g.service failed to load: Invalid argument. Failed to create trailing-g.service/start: Invalid argument
* Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek2014-07-31
| | | | | | | | | | | | | | | | | | | | | | String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
* resolved: when resolving an address PTR record via llmnr, make a tcp ↵Lennart Poettering2014-07-29
| | | | connection by default
* time-util: add and use USEC/NSEC_INFINIYKay Sievers2014-07-29
|