Commit graph

23328 commits

Author SHA1 Message Date
Filipe Brandenburger 0247447e96 extract-word: Skip coalesced separators in place
Just skip them in place, instead of setting separator=true. We only do
that in a single place (while finding a separator outside of quote or
backslash states) so we don't really need a separate state for it.

Tested that no regressions were introduced in test-extract-word. Ran a
full `make check` and also installed the binaries on a test system and
did not see any issues related to parsing unit files or starting units
after a reboot.
2015-11-05 21:57:26 -08:00
Filipe Brandenburger 27fc921b65 extract-word: Do not re-evaluate the state on each parsed character
Use inner loops to keep processing the same state, except when there is
a state change, then break back to the outer loop so that the correct
branch can be selected again.

Tested that no regressions were introduced in test-extract-word.
2015-11-05 21:51:24 -08:00
Filipe Brandenburger 93de9eb76d extract-word: increment pointer p and keep c in sync in for loop
This will make it easier to use inner loops to keep looping in the same
state, by just updating p and c in the same way in the inner loops.

Tested that no regressions were created in test-extract-word.
2015-11-05 21:41:04 -08:00
Filipe Brandenburger 8372da448f extract-word: Check for early bail out before inspecting separators
It's a pretty small optimization but doesn't hurt...

Tested with test-extract-word.
2015-11-05 21:31:29 -08:00
Filipe Brandenburger 3ff13c298d extract-word: replace an use of goto with structured code
Using `goto` might be appropriate for the "finish" cases but it was
really not necessary at this point of the code... Just use if/else
blocks to accomplish the same.

Confirmed that the test cases in test-extract-word keep working as
expected.
2015-11-05 21:19:54 -08:00
Filipe Brandenburger b85e1c2534 extract-word: move start block outside the for loop
This block runs once before all the other handling, so move it outside
the main loop and put it in its own loop until it's finished doing its
job.

Tested by confirming `make check` (and particularly test-extract-word)
still passes and by booting a system with binaries including this
commit.
2015-11-05 21:19:54 -08:00
Michal Schmidt 5263a45b5c sd-resolve: simplify pthread_join() call
POSIX says:
The pthread_join() function shall not return an error code of [EINTR].
2015-11-05 13:44:15 +01:00
Michal Schmidt 6ff6f4d851 timesync: return negative errno from manager_adjust_clock() on error 2015-11-05 13:44:14 +01:00
Michal Schmidt 35607a8d1c nspawn: save errno before reopening log after exec failure 2015-11-05 13:44:12 +01:00
Michal Schmidt 070edd97f3 nspawn: no fake errno
The S_ISREG test does not set errno, so don't use it in the error
message.
2015-11-05 13:44:11 +01:00
Michal Schmidt 4314d33f51 nspawn: simplify error returns
Use the "return log_error_errno(...)" idiom to have fewer curly braces.

The last hunk also fixes the return value of setup_journal(), but the
fix has no practical effect.
2015-11-05 13:44:10 +01:00
Michal Schmidt e26ea7fc2d libsystemd-network: inet_pton does not set errno on parsing error
it would set errno only for an invalid address family.

Also fix a copy&paste error in one error string.
2015-11-05 13:44:10 +01:00
Michal Schmidt 5cfab271fe import: report error before losing errno
unlink() may change errno, so report the error from rename() first, then
unlink.
2015-11-05 13:44:09 +01:00
Michal Schmidt 4546c34193 firstboot: fix errno sign 2015-11-05 13:44:08 +01:00
Michal Schmidt 7bb87460e6 journal: posix_fallocate() does not set errno
manpage says:
 posix_fallocate() returns zero on success, or an error number on
 failure. Note that errno is not set.
2015-11-05 13:44:07 +01:00
Michal Schmidt 709f6e46a3 treewide: use the negative error codes returned by our functions
Our functions return negative error codes.
Do not rely on errno being set after calling our own functions.
2015-11-05 13:44:06 +01:00
Michal Schmidt c3753458fc journal: fix incorrect errno reporting
pread() returns -1 on error and sets errno. Do not use the -1 as errno.
2015-11-05 13:44:06 +01:00
Michal Schmidt 77ba8233f7 journal: use int64_t instead of long for catalog file size
This replaces the use of ftell() with ftello() for 64-bit size on all
archs.

Also drops a pointless check for NULL before calling strbuf_cleanup().
2015-11-05 13:44:05 +01:00
Michal Schmidt 8d2ecdb2cf journal: drop unnecessary write_catalog() parameter
write_catalog() use the hashmap only to get its size. The size is
already given in parameter 'n'.
2015-11-05 13:44:04 +01:00
Michal Schmidt bcf5c276cc log: whitespace style fix 2015-11-05 13:44:03 +01:00
Michal Schmidt ad71eee550 tty-ask-password-agent: fix typo in error message 2015-11-05 13:44:01 +01:00
Vito Caputo ad231c7787 core: still make progress when throttling the manager loop
Don't simply continue after sleeping, it potentially puts us in a state
of spinning doing nothing slowly, if the ratelimit_test() keeps
detecting the need for limiting.

Observed in vms after the host had been suspended for a while, on resume
systemd entered a loop of making zero progress spamming the console
with:
[431942.850090] systemd[1]: Looping too fast. Throttling execution a
little.

I see no reason to have a continue here, the intention should be to
throttle execution, not circumvent it altogether.
2015-11-04 17:32:16 -08:00
Lennart Poettering a6bff4a742 Merge pull request #1761 from ssahani/word
core: parse socket port to extract_first_word
2015-11-04 20:16:14 +01:00
Lennart Poettering 50bcc7f45c Merge pull request #1778 from rhdrjones/detect-virt
detect-virt: one fix and arm/aarch64 dmi detection
2015-11-04 20:11:17 +01:00
Ronny Chevalier ffbc002ca4 Merge pull request #1780 from evverx/fix-install-dbus
test-functions: fix dbus-1 installation
2015-11-04 20:07:23 +01:00
Evgeny Vereshchagin e63b61be53 test-functions: fix dbus-1 installation
The basic setup for the well-known system and session buses is
now done in read-only files in ${datadir} (normally /usr/share).
See the NEWS entry for 1.9.18 for details.

http://cgit.freedesktop.org/dbus/dbus/tree/NEWS
2015-11-04 18:33:37 +00:00
Andrew Jones 3728dcde45 detect-virt: dmi: look for KVM
Some guests (ARM, AArch64, x86-RHEL) have 'KVM' in the product name.
Look for that first in order to more precisely report "kvm" when
detecting a QEMU/KVM guest. Without this patch we report "qemu",
even if KVM acceleration is in use on ARM/AArch64 guests.

I've only tested a backported version of this and the previous
patch on an AArch64 guest (which worked). Of course it would be
nice to get regression testing on all guest types that depend on
dmi done.
2015-11-04 11:19:40 -06:00
Andrew Jones 2ef8a4c439 arm/aarch64: detect-virt: check dmi
ARM/AArch64 guests now have SMBIOS tables populated (when boot
with a late enough QEMU and a late enough AAVMF is used as the
bootloader). Furthermore, when booting ARM/AArch64 guests with
ACPI, the DT detection obviously no longer works, so we need
dmi detection.
2015-11-04 11:19:37 -06:00
Andrew Jones 42685451ed detect-virt: detect in best-heuristic order
afaict, this will fix a regression caused by commit 75f86906c5.
Where we used to report "kvm" before that patch, without this patch,
we would only report "qemu". The reason is because cpuid detection
must come before dmi detection. Also, both can safely come before
other xen heuristics. Untested.
2015-11-04 11:19:33 -06:00
Lennart Poettering 51c41a97ec Merge pull request #1775 from fbuihuu/set-property-completion
bash-completion: add minimal support fpr 'set-property' command
2015-11-04 17:52:50 +01:00
Lennart Poettering ec947cf4da Merge pull request #1776 from marktheunissen/master
systemctl: update documentation for --plain option
2015-11-04 17:50:20 +01:00
Daniel Mack 7b50251d69 Merge pull request #1777 from torstehu/fix-typo2
core: fix typo
2015-11-04 14:13:12 +01:00
Torstein Husebø f1f849b0c6 core: fix typo 2015-11-04 13:18:59 +01:00
Daniel Mack 9fead19d58 Merge pull request #1773 from evverx/dont-hide-enomem
core: small fixes to parse_namespace
2015-11-04 12:17:18 +01:00
Mark Theunissen a20e43c0f6 systemctl: update documentation for --plain option
- Existing documentation did not mention that --plain omits the bullets and works on list-units and list-machines.
2015-11-04 13:14:03 +02:00
Lennart Poettering b3d2548baf Merge pull request #1768 from vcaputo/sd-daemon-listen-fds-overflow-bis
sd-daemon: fix potential LISTEN_FDS overflow in sd_listen_fds()
2015-11-04 11:55:40 +01:00
Franck Bui d82fabdb7f bash-completion: add minimal support fpr 'set-property' command
'set-property' was missing from the list of known command.

Also a list of unit names will be proposed as next argument.

However no support on property names is provided since it would
require a hard coded list of them.
2015-11-04 08:42:16 +01:00
Evgeny Vereshchagin 0293a7a830 core: small fixes to parse_namespace
* don't hide ENOMEM
* log r instead of 0
2015-11-04 00:41:18 +03:00
Vito Caputo 046c93f8db sd-daemon: fix potential LISTEN_FDS overflow in sd_listen_fds() 2015-11-03 11:13:26 -08:00
Susant Sahani 7b2313f5ca core: parse socket port to extract_first_word 2015-11-03 22:49:05 +05:30
Daniel Mack 5604b971cf Merge pull request #1767 from poettering/journald-watchdog
restore journald watchdog
2015-11-03 17:53:15 +01:00
Lennart Poettering 119e9655dc journal: restore watchdog support 2015-11-03 17:45:12 +01:00
Lennart Poettering caffe412c7 sd-daemon: explicitly filter out -1 when parsing watchdog timeout
We already filter out 0, and as -1 is usually special (meaning infinity,
as in USEC_INFINITY) we should better not accept it either. Better safe
than sorry...
2015-11-03 17:45:12 +01:00
Lennart Poettering a0f29c767a util-lib: move CONF_DIRS_NULSTR definition to def.h
After all, this is not some compiler or C magic, but something very
specific to how systemd works, hence let's move it into def.h, and out
of macro.h
2015-11-03 17:45:11 +01:00
Lennart Poettering b11d6a7bed util-lib: move character class definitions to string-util.h 2015-11-03 17:45:11 +01:00
Lennart Poettering 5703176d6e Merge pull request #1764 from ssahani/jiffies-1
(V2) networkd: bridge convert to jiffies
2015-11-03 17:38:22 +01:00
Susant Sahani 1a14863e7e networkd: bridge prop convert to jiffies 2015-11-03 21:59:42 +05:30
Susant Sahani 87b8ce69f6 Time-util: introduce usec to jiffies 2015-11-03 21:58:42 +05:30
Daniel Mack e37c57106e Merge pull request #1765 from teg/pppoe-removal
sd-pppoe: drop
2015-11-03 16:22:17 +01:00
Tom Gundersen 0f8980e48b sd-pppoe: drop
It is really unclear if we want to / have the resources to support this fully, so drop it
for now. It can easily be brought back if a killer usecase emerges.

Note that this code was never hooked up, so this does not remove any features.
2015-11-03 16:14:12 +01:00