1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-14 15:21:37 +03:00
Commit Graph

17094 Commits

Author SHA1 Message Date
Tom Gundersen
ed216e1ff0 udev: split out help and modernise a bit 2014-09-16 12:12:55 +02:00
Thomas Hindoe Paaboel Andersen
f70ca25ae0 man: sd_bus_error typo fix 2014-09-15 23:17:57 +02:00
David Herrmann
440046e922 terminal: fix missing hashmap_new() conversions
hashmap_new() now takes *_ops instead of individual functions. Fix up any
missing invokations of it that haven't been converted already.
2014-09-15 17:12:41 +02:00
Emil Renner Berthing
1acf166349 remove unneeded error.h includes
These are the only two places where this glibc-specific
header is included. However none of the definitions in it
seem to be used, so just remove the includes.
2014-09-15 17:02:25 +02:00
Michal Schmidt
4dd6c5726d sd-bus: use proper ITERATOR_FIRST abstraction
Do not assume hashmap iterators are pointers.
They may be structs in an alternative hashmap implementation.
2014-09-15 16:08:50 +02:00
Michal Schmidt
923041cb0a hashmap: minor hashmap_replace optimization
When hashmap_replace detects no such key exists yet, it calls hashmap_put that
performs the same check again. Avoid that by splitting the core of hashmap_put
into a separate function.
2014-09-15 16:08:50 +02:00
Michal Schmidt
631b9deefb hashmap, set: remove unused functions
The following hashmap_* and set_* functions/macros have never had any
users in systemd's history:

  *_iterate_backwards
  *_iterate_skip
  *_last
  *_FOREACH_BACKWARDS

Remove this dead code.
2014-09-15 16:08:50 +02:00
Michal Schmidt
d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
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.
2014-09-15 16:08:50 +02:00
Michal Schmidt
f44541bc93 build: colorize gcc only if on tty
Rather than forcing gcc to always produce colorized error messages
whether on tty or not, enable automatic colorization by ensuring
GCC_COLORS is set to a non-empty string.

Doing it this way removes the need for workarounds in ~/.emacs or
~/.vimrc for "M-x compile" or ":make", respectively, to work.
2014-09-15 16:08:50 +02:00
Thomas Hindoe Paaboel Andersen
20755373b1 test: fix test of uid-range
The number of uid's in the range should be tested instead of written
directly.

The test still passes with the fix checks.

Found with Coverity. Fixes: CID#1237714 - 1237722
2014-09-14 22:47:21 +02:00
Thomas Hindoe Paaboel Andersen
86be3e1e65 sd-dhcp: fix test of magic cookie
The magic cookie is set in dhcp_message_init. Test the magic cookie
value intead of writing the last 3/4 of it directly.

Found with Coverity. Fixes: CID#1237732 CID#1237734 CID#1237735
2014-09-14 22:47:21 +02:00
Tom Gundersen
d1c457badf resolved: fall back to hardcoded ifindex when checking if a link is the loopback
Reported by Philippe De Swert <philippedeswert@gmail.com>.

Coverity CID#1237656
2014-09-13 21:10:59 +02:00
Dave Reisner
124f09e812 networkd: remove vestigial event sources
187fe1db took advantage of floating events, but didn't remove pointers
it made superfluous.
2014-09-13 14:18:20 -04:00
Dave Reisner
eed9386748 core: use correct function to free CalendarSpec 2014-09-13 11:18:26 -04:00
Thomas Hindoe Paaboel Andersen
4d5e13a125 core: fix a potential mem leak
Found with Coverity. Fixes: CID#996438
2014-09-13 12:38:39 +02:00
Thomas Hindoe Paaboel Andersen
0ee9613d98 analyze: fix mem leak
Found with Coverity. Fixes: CID#1237756
2014-09-13 12:38:39 +02:00
Philippe De Swert
b9289d4c6e core: smack-setup: Actually allow for succesfully loading CIPSO policy
The line under the last switch statement  *loaded_policy = true;
would never be executed. As all switch cases return 0. Thus the
policy would never be marked as loaded.

Found with Coverity. Fixes: CID#1237785
2014-09-13 11:54:09 +02:00
Thomas Hindoe Paaboel Andersen
d725a138c5 analyze: avoid a null dereference
If we have an error in the early sd_bus_* calls then unit_times
will still be null.

Found with coverity. Fixes: CID#996464
2014-09-11 23:45:36 +02:00
Tom Gundersen
6711741365 udev: timeout - warn after a third of the timeout before killing 2014-09-11 23:45:01 +02:00
Thomas Hindoe Paaboel Andersen
e926f6475d firstboot: silence a warning
No change in behavoir as the fallthrough from ARG_COPY had already
set arg_copy_locale to true.

Found with coverity. Fixes: CID#1237622
2014-09-11 21:29:59 +02:00
Thomas Hindoe Paaboel Andersen
807d0cca2b manager: use correct cleanup function
Close the dir instead of attempt to free it.

Introduced in 874310b7b6

Found with coverity. Fixes: CID#996368
2014-09-11 21:22:45 +02:00
Philippe De Swert
aa44499da1 activate: fix fd leak in do_accept()
Found with Coverity.
2014-09-11 17:47:37 +02:00
David Herrmann
3f2e132a19 test: fix mem-leak in fdopen() test
We must free FILE* after function return to not leak resources. Note that
this also closes our fd as fdopen() takes ownership of it.
Reported by Philippe De Swert (via coverity).
2014-09-11 17:39:17 +02:00
Philippe De Swert
2b347169b9 bus: unref buscreds on failure
Actually unref the buscreds when we are not going to return a
pointer to them. As when bus_creds_add_more fails we immediately
return the error code otherwise and leak the new buscreds.
Found with coverity. Fixes: CID#1237761
2014-09-11 17:29:19 +02:00
Philippe De Swert
b67ddc7bbe journal: do not leak mmaps on OOM
After a section of memory is succesfully allocated, some of the following
actions can still fail due to lack of memory. In this case -ENOMEM is
returned without actually freeing the already mapped memory.
Found with coverity. Fixes: CID#1237762
2014-09-11 17:27:44 +02:00
David Herrmann
21978bc3c9 terminal: fix uninitialized variable in strerror() log message
We currently print weird error-messages if xkbcommon fails (which cannot
fail so far, but might in the future). Fix the uninitialized variable
warnings by setting 'r' correctly.
Thanks to Philippe De Swert for catching this (via coverity).
2014-09-11 17:20:11 +02:00
Philippe De Swert
48d4c7468f journal: do not dereference already freed patterns
In case set_consume goes wrong, the pattern name has already been
freed. So we do not try to print it in the logs, assuming the pattern
addition print will be printed just before the failure anyway. Found
with coverity. Fixes: CID#1237798
2014-09-11 17:13:59 +02:00
Philippe De Swert
fd989a0bc9 bus: avoid using m->kdbus after freeing it
m->kdbus could be freed before it is released. Changing the
order fixes the issue.

Found with Coverity. Fixes: CID#1237798
2014-09-11 17:09:50 +02:00
David Herrmann
393a5ba09f terminal: drop redundant assertion
This assertion is already there two lines down. Drop the redundant
assertion.
2014-09-11 15:30:56 +02:00
David Herrmann
667b60341f terminal: fix wrong return value in idev if fcntl() fails
This might cause >=0 to be returned, even though the method failed. Fix
this and return -errno.
2014-09-11 15:29:58 +02:00
David Herrmann
c600022303 terminal: enable sessions in evcat after taking control
If we enable a session, any probed device might get immediately enabled.
This might cause TakeDevice() messages to be sent before we call
TakeControl(). Therefore, enable sessions *after* sending TakeControl() so
we always succeed if TakeControl() succeeds.
2014-09-11 15:28:37 +02:00
David Herrmann
1f3752c81a terminal: remove unused set.h inclusion in idev
We don't use set.h so no need to include it. We used to include it for
temporary refs on all idev devices of a session, but that never was pushed
upstream.
2014-09-11 15:27:56 +02:00
David Herrmann
8e3ba3772c udev: allow removing tags via TAG-="foobar"
This extends the udev parser to support OP_REMOVE (-=) and adds support
for TAG-= to remove previously set tags. We don't fail if the tag didn't
exist.

This is pretty handy if we ship default rules for seat-assignments and
users want to exclude specific devices from that. They can easily add
rules that drop any automatically added "seat" tags again.
2014-09-11 15:22:16 +02:00
David Herrmann
2e1dd622ee terminal: remove redundant "struct" prefixes
We define typedefs for all internal types so drop the redundant "struct"
prefix.
2014-09-11 15:22:16 +02:00
David Herrmann
98b7fe2ad4 terminal: discard async read() errors for evdev
If read() fails on evdev devices, we deal with this in idev_evdev_hup().
It is very likely this is an async revoke, therefore, we must not abort.
Fix our io helper to discard such errors after passing them to
idev_evdev_hup(), so we don't bail out of the event loop.
2014-09-11 15:22:16 +02:00
Michael Biebl
b76388e123 backlight: Avoid error when state restore is disabled
When the state restore is disabled, we would print:
"Unknown verb: load" instead of simply skipping loading the
state.
2014-09-11 00:53:49 +02:00
Tom Gundersen
b5338a1986 udev: timeout - increase timeout
Some kernel modules still take more than one minute to insmod, we no longer rely on the timeout
killing insmod within a given period of time, so just bump this to a much higher value. Its only
purpose is to make sure that nothing stays aronud forever.
2014-09-10 18:10:06 +02:00
Tom Gundersen
ec3281d3b6 udev: fix copy-paste error in log message 2014-09-10 18:09:32 +02:00
Patrik Flykt
e9385929c8 TODO: Remove Elapsed Time DHCPv6 option as it is done 2014-09-10 12:56:46 +03:00
Patrik Flykt
d63be95a30 test-dhcp6-client: Add checks for Elapsed Time option
Verify that the Elapsed Time option is present.
2014-09-10 12:56:29 +03:00
Patrik Flykt
346e13a25d sd-dhcp6-client: Implement Elapsed Time option
Implement Elapsed Time option as it is defined as MUST in RFC 3315,
section 22.9. The elapsed time value is a 1/100th of a second with
a max value of 0xffff, i.e. 655.35 seconds.

As the main loop might not be running yet when sd_dhcp6_client_start() is
called, fetch the monotonic time directly and not from the event loop
while in state DHCP6_STATE_STOPPED.
2014-09-10 12:56:24 +03:00
Tom Gundersen
9d19a679f2 udev - drop print_kmsg
The only remaining user was 'starting version XXX', which is now logged using log_info().
2014-09-09 22:48:57 +02:00
Tom Gundersen
1187f20655 udev: netif_rename - don't log to kmsg
As of 3.17, the kernel will do this on its own, so just do regular log_debug() logging from udev.
2014-09-09 22:45:03 +02:00
Tom Gundersen
aedca89268 udev: net_setup_link - open ethtool and rtnl connections lazily 2014-09-09 15:36:56 +02:00
Tom Gundersen
4c83d99456 udev: event - keep one rtnl per worker, rather than per event
Creating the rtnl context is cheap, but freeing it may not be, due to
synchronous close().

Also drop some excessive logging. We now log about the changing ifname
exactly once.
2014-09-09 15:30:10 +02:00
Tom Gundersen
b081b27e14 udev: import the full db on MOVE events for devices without dev_t 2014-09-09 15:03:49 +02:00
Ivan Shapovalov
72ba9f04f9 build-sys: make hibernation support configure option also handle hybrid-sleep; fix indentation 2014-09-09 15:03:49 +02:00
Marcel Holtmann
fea0bfaed5 hwdb: update 2014-09-09 07:44:02 +02:00
Thomas Hindoe Paaboel Andersen
822a59607c execute: silence warnings
Mark two function parameters as const
2014-09-08 22:10:36 +02:00
Thomas Hindoe Paaboel Andersen
120d578e5f namespace: avoid posible use of uninitialized variable 2014-09-08 22:09:41 +02:00