chiark / gitweb /
elogind.git
9 years agoSilence some "unchecked return-value" warnings
David Herrmann [Tue, 23 Sep 2014 11:33:53 +0000 (13:33 +0200)]
Silence some "unchecked return-value" warnings

This adds some log-messages to ioctl() calls where we don't really care
for the return value. It isn't strictly necessary to look for those, but
lets be sure and print warnings. This silences gcc and coverity, and also
makes sure we get reports in case something goes wrong and we didn't
expect it to fail that way.

9 years agosd-bus: sync kdbus.h
Daniel Mack [Tue, 23 Sep 2014 15:37:44 +0000 (17:37 +0200)]
sd-bus: sync kdbus.h

9 years agosd-bus: sync kdbus.h (API break)
Daniel Mack [Tue, 23 Sep 2014 14:13:54 +0000 (16:13 +0200)]
sd-bus: sync kdbus.h (API break)

Just a rename of two struct members to make the header file c++ compatible.

9 years agolocaled: rename write_data_x11 to x11_write_data
Zbigniew Jędrzejewski-Szmek [Thu, 4 Sep 2014 16:30:46 +0000 (12:30 -0400)]
localed: rename write_data_x11 to x11_write_data

Other functions in this file follow this pattern,
we have vconsole_write_data and locale_write_data.

9 years agoFix warning about unused variable with !SELINUX
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 13:22:40 +0000 (09:22 -0400)]
Fix warning about unused variable with !SELINUX

src/shared/label.c:255:15: warning: unused variable 'l' [-Wunused-variable]
         char *l = NULL;
               ^

9 years agoterminal: fix spelling mistake
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 13:22:33 +0000 (09:22 -0400)]
terminal: fix spelling mistake

9 years agologind: add support for Triton2 Power Button
Zbigniew Jędrzejewski-Szmek [Tue, 23 Sep 2014 02:14:39 +0000 (22:14 -0400)]
logind: add support for Triton2 Power Button

https://bugs.freedesktop.org/show_bug.cgi?id=84201

9 years agosd-bus: sync kdbus.h (API+ABI break)
Daniel Mack [Mon, 22 Sep 2014 16:20:14 +0000 (18:20 +0200)]
sd-bus: sync kdbus.h (API+ABI break)

The kdbus logic name registry logic was changed to transport the actual
name to acquire, release or report in a kdbus item.

This brings the name API a little more in line with other calls, and allows
for later augmentation.

Follow that change on the systemd side.

9 years agoutil: avoid non-portable __WORDSIZE
Emil Renner Berthing [Fri, 19 Sep 2014 18:26:53 +0000 (20:26 +0200)]
util: avoid non-portable __WORDSIZE

Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

(David: adjust commit message to explain why we do this)

9 years agoterminal: signal object removal during sysview_context_stop()
David Herrmann [Mon, 22 Sep 2014 16:05:19 +0000 (18:05 +0200)]
terminal: signal object removal during sysview_context_stop()

Now that we no longer propagate callback return values, we can safely call
into user-callbacks during sysview_context_stop(). This way, users can
rely on all objects to be removed via callbacks (except if they failed
during object creation). This avoids duplicating any object hashtables on
the users' side and reduces memory consumption.

9 years agoterminal: handle callback errors in sysview instead of propagating them
David Herrmann [Mon, 22 Sep 2014 15:55:31 +0000 (17:55 +0200)]
terminal: handle callback errors in sysview instead of propagating them

We cannot sanely propagate error codes if we call into user-callbacks
multiple times for multiple objects. There is no way to merge those errors
or somehow propagate them.

However, we can just act similar to sd-event and print a log-message while
discarding the values. This way, we allow error-returns, but can properly
continue working on our objects.

9 years agoterminal: allow user-context to be retrieved/stored
David Herrmann [Mon, 22 Sep 2014 15:37:21 +0000 (17:37 +0200)]
terminal: allow user-context to be retrieved/stored

Add "userdata" storage to a bunch of external objects, namely displays and
sessions. Furthermore, add some property retrieval helpers.

This is required if we want external API users to not duplicate our own
object hashtables, but retrieve context from the objects themselves.

9 years agoterminal: make evdev logind-matches per session
David Herrmann [Mon, 22 Sep 2014 15:34:13 +0000 (17:34 +0200)]
terminal: make evdev logind-matches per session

Instead of adding matches per device, we now add logind matches per
session. This reduces the number of matches considerably and saves
resources.

9 years agoexit-status.c: bring EXIT_BUS_ENDPOINT label in line with others
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:15:49 +0000 (09:15 -0400)]
exit-status.c: bring EXIT_BUS_ENDPOINT label in line with others

9 years agoman: fix typo and add link
Zbigniew Jędrzejewski-Szmek [Mon, 22 Sep 2014 13:13:38 +0000 (09:13 -0400)]
man: fix typo and add link

9 years agologin: add public sd_session_get_desktop() API
David Herrmann [Sat, 20 Sep 2014 16:42:29 +0000 (18:42 +0200)]
login: add public sd_session_get_desktop() API

The desktop brand is stored as DESKTOP variable for sessions. It can be
set arbitrarily by the session owner and identifies the desktop
environment that is running on that session.

9 years agobus: align kdbus ioctl parameters to 8byte
David Herrmann [Mon, 22 Sep 2014 10:49:47 +0000 (12:49 +0200)]
bus: align kdbus ioctl parameters to 8byte

All kdbus ioctl arguments must be 8byte aligned. Make sure we use
alloca_align() and _alignas_(8) in all situations where gcc doesn't
guarantee 8-byte alignment.

Note that objects on the stack are always 8byte aligned as we put
_alignas_(8) into the structure definition in kdbus.h.

9 years agoutil: add alloca_align()
David Herrmann [Mon, 22 Sep 2014 10:05:16 +0000 (12:05 +0200)]
util: add alloca_align()

The alloca_align() helper is the alloca() equivalent of posix_memalign().
As there is no such function provided by glibc, we simply account for
additional memory and return a pointer offset into the allocated memory to
grant the alignment.

Furthermore, alloca0_align() is added, which simply clears the allocated
memory.

9 years agotest-util: make valgrind happy
David Herrmann [Mon, 22 Sep 2014 09:27:22 +0000 (11:27 +0200)]
test-util: make valgrind happy

Properly free all temporary resources to make valgrind not complain about
lost records.

9 years agoterminal: raise sysview DEVICE_CHANGE events per attachment
David Herrmann [Sat, 20 Sep 2014 15:47:56 +0000 (17:47 +0200)]
terminal: raise sysview DEVICE_CHANGE events per attachment

Instead of raising DEVICE_CHANGE only per device, we now raise it per
device-session attachment. This is what we want for all sysview users,
anyway, as sessions are meant to be independent of each other. Lets avoid
any external session iterators and just do that in sysview itself.

9 years agoterminal: forward evdev RESYNC events to linked devices
David Herrmann [Sat, 20 Sep 2014 10:39:59 +0000 (12:39 +0200)]
terminal: forward evdev RESYNC events to linked devices

Whenever we resync an evdev device (or disable it), we should send RESYNC
events to the linked upper layers. This allows to disable key-repeat and
assume some events got dropped.

9 years agoterminal: always call _enable/_disable on evdev devices
David Herrmann [Sat, 20 Sep 2014 10:34:43 +0000 (12:34 +0200)]
terminal: always call _enable/_disable on evdev devices

The current pause/resume logic kinda intertwines the resume/pause and
enable/disable functions. Lets avoid that non-obvious behavior and always
make resume call into enable, and pause call into disable, if appropriate.

9 years agoterminal: print RESYNC state in evcat
David Herrmann [Sat, 20 Sep 2014 10:33:18 +0000 (12:33 +0200)]
terminal: print RESYNC state in evcat

Whenever a key-event is part of a RESYNC, we should print that verbosely
as those events are out-of-order.

9 years agobus-policy: add test utility
Daniel Mack [Fri, 19 Sep 2014 12:50:53 +0000 (14:50 +0200)]
bus-policy: add test utility

Add some test files and routines for dbus policy checking.

9 years agobus-policy: add policy check function
Daniel Mack [Fri, 19 Sep 2014 12:38:52 +0000 (14:38 +0200)]
bus-policy: add policy check function

Add policy_check() to actually check whether an incoming message is allowed
by the policy. The code is not yet used from the proxy daemon, though.

9 years agobus-policy: print numeric [gu]id in dump_items()
Daniel Mack [Sat, 20 Sep 2014 16:09:00 +0000 (18:09 +0200)]
bus-policy: print numeric [gu]id in dump_items()

9 years agobus-policy: do not exit() from policy_dump()
Daniel Mack [Sat, 20 Sep 2014 13:59:40 +0000 (15:59 +0200)]
bus-policy: do not exit() from policy_dump()

This function is quite useful for debugging. Exiting from it seems
unnecessary.

9 years agobus-policy: implement dump_items() with LIST_FOREACH
Daniel Mack [Fri, 19 Sep 2014 12:05:18 +0000 (14:05 +0200)]
bus-policy: implement dump_items() with LIST_FOREACH

Instead of making the function call itself recursively.

9 years agobus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP}
Daniel Mack [Sat, 20 Sep 2014 02:34:30 +0000 (04:34 +0200)]
bus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP}

Do the lookup during parsing already, and set i->uid, or i->gid to the
numerical values.

9 years agobus_policy: set i->[ug]id_valid
Daniel Mack [Sat, 20 Sep 2014 14:34:31 +0000 (16:34 +0200)]
bus_policy: set i->[ug]id_valid

9 years agobus-policy: append items rather than prepending them
Daniel Mack [Fri, 19 Sep 2014 20:05:01 +0000 (22:05 +0200)]
bus-policy: append items rather than prepending them

In the D-Bus policy, the order of items matters, so make sure to store them
in the same order as they are parsed by the sax parser.

9 years agobus-policy: story mandatory items in right list
Daniel Mack [Fri, 19 Sep 2014 15:50:41 +0000 (17:50 +0200)]
bus-policy: story mandatory items in right list

9 years agotest: udev - restrict nemuric uid's to existing ones
Tom Gundersen [Sat, 20 Sep 2014 16:12:53 +0000 (18:12 +0200)]
test: udev - restrict nemuric uid's to existing ones

We now verify the existence of uid's before applying them to devicenodes, so change the
test accordingly. We assume that both uid/gid 1 and 2 exist on the test system.

9 years agoterminal: fix mode sync for connectors
David Herrmann [Sat, 20 Sep 2014 09:43:32 +0000 (11:43 +0200)]
terminal: fix mode sync for connectors

The GETXY ioctls of DRM are usually called twice by libdrm: Once to
retrieve the number of objects, a second time with suitably sized buffers
to actually retrieve all objects. In grdrm, we avoid these excessive calls
and instead just call ioctls with cached buffers and resize them if they
were too small.

However, connectors need to read the mode list via EDID, which is horribly
slow. As the kernel still cannot do that asynchronously (seriously, we
need to fix this!), it has a hack to only do it if count_modes==0. This is
fine with libdrm, as it calls every ioctl twice, anyway. However, we fail
horribly with this as we usually never pass 0.

Fix this by calling into GETCONNECTOR ioctls twice in case we received an
hotplug event. Only in those cases, we need to re-read modes, so this
should be totally fine.

9 years agoterminal: restructure some logging calls in grdrm
David Herrmann [Sat, 20 Sep 2014 09:41:34 +0000 (11:41 +0200)]
terminal: restructure some logging calls in grdrm

Multiple issues here:
 1) Don't print excessive card dumps on each resync. Disable it and make
    developers add it themselves.
 2) Ignore EINVAL on page-flips. Some cards don't support page-flips, so
    we'd print it on each frame. Maybe, at some point, the kernel will add
    support to retrieve capabilities for that. Until then, simply ignore
    it.
 3) Replace the now dropped card-dump with a short message about resyncing
    the card.

9 years agoterminal: grdev: schedule virtual frame events if hw doesn't support it
David Herrmann [Sat, 20 Sep 2014 09:12:44 +0000 (11:12 +0200)]
terminal: grdev: schedule virtual frame events if hw doesn't support it

Whenever we cannot use hardware frame events, we now schedule a virtual
frame event to make sure applications don't have to do this. Usually,
applications render only on data changes, but we can further reduce
render-time by also limiting rendering to vsyncs.

9 years agoterminal: grdev: raise frame event after DISPLAY_ADD/CHANGE
David Herrmann [Sat, 20 Sep 2014 09:11:07 +0000 (11:11 +0200)]
terminal: grdev: raise frame event after DISPLAY_ADD/CHANGE

Whenever a display is added or changed, we suppressed any frame events.
Make sure to raise them manually so we can avoid rendering when handling
anything but FRAME events.

9 years agoterminal: split grdrm_crtc_commit() apart
David Herrmann [Sat, 20 Sep 2014 09:10:04 +0000 (11:10 +0200)]
terminal: split grdrm_crtc_commit() apart

This helper is quite huge, split it apart to make it easier to follow.

9 years agoterminal: grdev: refresh device state on hotplug events
David Herrmann [Sat, 20 Sep 2014 07:50:10 +0000 (09:50 +0200)]
terminal: grdev: refresh device state on hotplug events

Whenever we get udev hotplug events, re-read the device state so we
properly detect any changed in the display setups.

9 years agoterminal: grdev: treat udev-devices without devnum as hotplug
David Herrmann [Sat, 20 Sep 2014 07:48:22 +0000 (09:48 +0200)]
terminal: grdev: treat udev-devices without devnum as hotplug

If we get udev-device events via sysview, but they lack devnum
annotations, we know it cannot be a DRM card. Look through it's parents
and treat it as hotplug event in case we find such a card.

This will treat any new/removed connectors as sub-devices of the real
card, instead of as devices on its own.

9 years agoterminal: modeset: forward DEVICE_CHANGE events into grdev
David Herrmann [Sat, 20 Sep 2014 07:46:13 +0000 (09:46 +0200)]
terminal: modeset: forward DEVICE_CHANGE events into grdev

Properly forward DEVICE_CHANGE events into grdev so we can react to
changing display setups.

9 years agoterminal: reduce speed of morphing colors in modeset test
David Herrmann [Sat, 20 Sep 2014 07:45:26 +0000 (09:45 +0200)]
terminal: reduce speed of morphing colors in modeset test

The high frequency of the color-morphing is kinda irritating. Reduce it
to a much lower frequency so you can actually look at it longer than few
seconds.

9 years agoterminal: make drm-connectors first-level devices
David Herrmann [Sat, 20 Sep 2014 07:44:14 +0000 (09:44 +0200)]
terminal: make drm-connectors first-level devices

So far, we only forward DRM cards via sysview APIs. However, with MST,
connectors can be hotplugged, too. Forward the connectors as first-level
devices via sysview so API users can react to changing DRM connectors.

9 years agoterminal: forward DEVICE_CHANGE events via sysview
David Herrmann [Sat, 20 Sep 2014 07:43:16 +0000 (09:43 +0200)]
terminal: forward DEVICE_CHANGE events via sysview

Whe need to react to "change" events on devices, but we want to avoid
duplicating udev-monitors everywhere. Therefore, make sysview forward
change events to the sysview controllers, which can then properly react
to it.

9 years agoterminal: parse ID_SEAT not only for parents but the device itself
David Herrmann [Sat, 20 Sep 2014 07:29:11 +0000 (09:29 +0200)]
terminal: parse ID_SEAT not only for parents but the device itself

When deciding what seat a device is on, we have to traverse all parents
to find one with an ID_SEAT tag, otherwise, input devices plugged on a
seated USB-hub are not automatically attached to the right seat. But any
tags on the main device still overwrite the tags of the childs, so fix our
logic to check the device itself first, before traversing the parents.

9 years agonspawn: don't try to create veth link with too long ifname
Tom Gundersen [Fri, 19 Sep 2014 21:02:00 +0000 (23:02 +0200)]
nspawn: don't try to create veth link with too long ifname

Reported by: James Lott <james@lottspot.com>

9 years agoterminal: add systemd-modeset debugging tool
David Herrmann [Fri, 19 Sep 2014 12:48:54 +0000 (14:48 +0200)]
terminal: add systemd-modeset debugging tool

The systemd-modeset tool is meant to debug grdev issues. It simply
displays morphing colors on any found display. This is pretty handy to
look for tearing in the backends and debug hotplug issues.

Note that this tool requires systemd-logind to be compiled from git
(there're important fixes that haven't been released, yet).

9 years agoterminal: add grdev DRM backend
David Herrmann [Fri, 19 Sep 2014 12:13:06 +0000 (14:13 +0200)]
terminal: add grdev DRM backend

The grdev-drm backend manages DRM cards for grdev. Any DRM card with
DUMB_BUFFER support can be used. So far, our policy is to configure all
available connectors, but keep pipes inactive as long as users don't
enable the displays on top.

We hard-code double-buffering so far, but can easily support
single-buffering or n-buffering. We also require XRGB8888 as format as
this is required to be supported by all DRM drivers and it is what VTs
use. This allows us to switch from VTs to grdev via page-flips instead of
deep modesets.

There is still a lot room for improvements in this backend, but it works
smoothly so far so more enhanced features can be added later.

9 years agoterminal: add graphics interface
David Herrmann [Fri, 19 Sep 2014 12:05:52 +0000 (14:05 +0200)]
terminal: add graphics interface

The grdev layer provides graphics-device access via the
libsystemd-terminal library. It will be used by all terminal helpers to
actually access display hardware.

Like idev, the grdev layer is built around session objects. On each
session object you add/remove graphics devices as they appear and vanish.
Any device type can be supported via specific card-backends. The exported
grdev API hides any device details.

Graphics devices are represented by "cards". Those are hidden in the
session and any pipe-configuration is automatically applied. Out of those,
we configure displays which are then exported to the API user. Displays
are meant as lowest hardware entity available outside of grdev. The
underlying pipe configuration is fully hidden and not accessible from the
outside. The grdev tiling layer allows almost arbitrary setups out of
multiple pipes, but so far we only use a small subset of this. More will
follow.

A grdev-display is meant to represent real connected displays/monitors.
The upper level screen arrangements are user policy and not controlled by
grdev. Applications are free to apply any policy they want.

Real card-backends will follow in later patches.

9 years agologin: pause devices before acknowledging VT switches
David Herrmann [Fri, 19 Sep 2014 11:26:39 +0000 (13:26 +0200)]
login: pause devices before acknowledging VT switches

If a session controller does not need synchronous VT switches, we allow
them to pass VT control to logind, which acknowledges all VT switches
unconditionally. This works fine with all sessions using the dbus API,
but causes out-of-sync device use if we switch to legacy sessions that
are notified via VT signals. Those are processed before logind notices
the session-switch via sysfs. Therefore, leaving the old session still
active for a short amount of time.

This, in fact, may cause the legacy session to prepare graphics devices
before the old session was deactivated, and thus, maybe causing the old
session to interfer with graphics device usage.

Fix this by releasing devices immediately before acknowledging VT
switches. This way, sessions without VT handlers are required to support
async session switching (which they do in that case, anyway).

9 years agosocket: introduce SELinuxContextFromNet option
Michal Sekletar [Thu, 24 Jul 2014 08:40:28 +0000 (10:40 +0200)]
socket: introduce SELinuxContextFromNet option

This makes possible to spawn service instances triggered by socket with
MLS/MCS SELinux labels which are created based on information provided by
connected peer.

Implementation of label_get_child_mls_label derived from xinetd.

Reviewed-by: Paul Moore <pmoore@redhat.com>
9 years agoshared: wtmp-utmp - don't clear store_wtmp in utmp_put_dead_process()
Tom Gundersen [Fri, 19 Sep 2014 06:03:31 +0000 (08:03 +0200)]
shared: wtmp-utmp - don't clear store_wtmp in utmp_put_dead_process()

Also modernize a few other things and add comments to explain CID #1237503
and CID #1237504.

9 years agotest: warn if we could not parse the loop count argument
Thomas Hindoe Paaboel Andersen [Thu, 18 Sep 2014 23:43:04 +0000 (01:43 +0200)]
test: warn if we could not parse the loop count argument

Found by coverity. Fixes: CID#1237512

9 years agoshared/sparse-endian.h: add missing byteswap.h include
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:43 +0000 (15:24 +0200)]
shared/sparse-endian.h: add missing byteswap.h include

9 years agoshared/label.h: add missing stdio.h include
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:42 +0000 (15:24 +0200)]
shared/label.h: add missing stdio.h include

9 years agopty: include linux/ioctl.h for TIOCSIG
David Herrmann [Thu, 18 Sep 2014 22:23:42 +0000 (00:23 +0200)]
pty: include linux/ioctl.h for TIOCSIG

TIOCSIG is linux specific, so include the linux ioctl header to make sure
it's defined. We currently rely on some rather non-obvious recursive
includes. Make sure its always defined regardless of the system headers.

9 years agonss: remove dead code
Thomas Hindoe Paaboel Andersen [Thu, 18 Sep 2014 21:55:46 +0000 (23:55 +0200)]
nss: remove dead code

c > 0 is already guaranteed from earlier checks.

We go from

ms = ALIGN(l+1) +
        sizeof(char*) +
        (c > 0 ? c : 1) * ALIGN(alen) +
        (c > 0 ? c+1 : 2) * sizeof(char*);

to

ms = ALIGN(l+1) +
        sizeof(char*) +
        c * ALIGN(alen) +
        (c+1) * sizeof(char*);

to

ms = ALIGN(l+1) + c * ALIGN(alen) + (c+2) * sizeof(char*);

Found by coverity. Fixes: CID#1237570 and CID#1237610

9 years agotimesyncd: check return of setting IP_TOS
Tom Gundersen [Thu, 18 Sep 2014 21:37:07 +0000 (23:37 +0200)]
timesyncd: check return of setting IP_TOS

Fonud by Coverity. Fixes CID #1237534.

9 years agoudevd: don't fail if /run/udev exists
Tom Gundersen [Thu, 18 Sep 2014 19:57:49 +0000 (21:57 +0200)]
udevd: don't fail if /run/udev exists

9 years agoudev: fix typos
Tom Gundersen [Thu, 18 Sep 2014 18:25:33 +0000 (20:25 +0200)]
udev: fix typos

Spotted by Andreas Henriksson.

9 years agoudev: ctrl - log if setting SO_PASSCRED fails
Tom Gundersen [Thu, 18 Sep 2014 17:26:11 +0000 (19:26 +0200)]
udev: ctrl - log if setting SO_PASSCRED fails

No functional change.

Found by Coverity. Fixes CID #1237533.

9 years agoudev: node - warn if chmod/chown fails
Tom Gundersen [Thu, 18 Sep 2014 17:22:09 +0000 (19:22 +0200)]
udev: node - warn if chmod/chown fails

No functional change, just log the warning.

Fonud by Coverity. Fixes CID #1237544.

9 years agoudevadm: hwdb - check return value of fseeko()
Tom Gundersen [Thu, 18 Sep 2014 17:16:54 +0000 (19:16 +0200)]
udevadm: hwdb - check return value of fseeko()

Fonud by Coverity. Fixes CID #996255.

9 years agoudevd: check return of various functions
Tom Gundersen [Thu, 18 Sep 2014 17:07:02 +0000 (19:07 +0200)]
udevd: check return of various functions

One reported by Coverity. Fixes CID #996252.

9 years agoudevd: parse_argv - warn if argumens are invalid
Tom Gundersen [Thu, 18 Sep 2014 17:02:03 +0000 (19:02 +0200)]
udevd: parse_argv - warn if argumens are invalid

Found by Coverity. Fixes CID #1238780.

9 years agojournal-remote: check return code of sd_event_default
Andreas Henriksson [Thu, 18 Sep 2014 15:52:54 +0000 (17:52 +0200)]
journal-remote: check return code of sd_event_default

Handle sd_event_default returning error and bail out properly
as done in every other caller of this function.

Found by coverity. Fixes: CID#1238957

9 years agosysusers: Remove some gcc warnings about uninitialized variables
Philippe De Swert [Thu, 18 Sep 2014 15:56:57 +0000 (18:56 +0300)]
sysusers: Remove some gcc warnings about uninitialized variables

Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.

9 years agocore: Remove uninitialized warnings from bus-endpoint.c
Philippe De Swert [Thu, 18 Sep 2014 15:56:56 +0000 (18:56 +0300)]
core: Remove uninitialized warnings from bus-endpoint.c

Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.

9 years agojournal-upload: Remove compilation warning
Philippe De Swert [Thu, 18 Sep 2014 15:56:55 +0000 (18:56 +0300)]
journal-upload: Remove compilation warning

When compiling we see this curl warning popping up:
src/journal-remote/journal-upload.c:194:17: warning: call to
‘_curl_easy_setopt_err_error_buffer’ declared with attribute
warning: curl_easy_setopt expects a char buffer of CURL_ERROR_SIZE
as argument for this option [enabled by default]
This patch removes the warning (which occurs twice).

9 years agomount: order options before other arguments to mount
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:59 +0000 (15:24 +0200)]
mount: order options before other arguments to mount

9 years agoinclude fcntl.h rather than sys/fcntl.h
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:38 +0000 (15:24 +0200)]
include fcntl.h rather than sys/fcntl.h

9 years agosd-rtnl: rtnl-message: remove unneeded linux includes
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:40 +0000 (15:24 +0200)]
sd-rtnl: rtnl-message: remove unneeded linux includes

9 years agoudev: link-config: remove unneded linux/netdevice.h include
Emil Renner Berthing [Thu, 18 Sep 2014 13:24:39 +0000 (15:24 +0200)]
udev: link-config: remove unneded linux/netdevice.h include

9 years agojournal: Do not count on the compiler initializing found_last to false
Philippe De Swert [Tue, 16 Sep 2014 21:27:16 +0000 (00:27 +0300)]
journal: Do not count on the compiler initializing found_last to false

There is a very unlikely case where this can happen since gcc usually
does the sane thing. But let's make sure found_last is initialized anyway.

Fixes: CID#996386
9 years agoman: use the escape for "-" in example instead of space.
Michael Marineau [Mon, 15 Sep 2014 21:07:39 +0000 (14:07 -0700)]
man: use the escape for "-" in example instead of space.

This sentence can be misread to mean that "\x20" is the escape code for
"-" which is the only character explicitly mentioned. This lead to at
least one user loosing hair over why a mount unit for "/foo/bar-baz"
didn't work. The example escape is arbitrary so lets prevent hair loss.

9 years agoudev: fix path for database names on 'change' event
Robert Milasan [Sat, 13 Sep 2014 13:18:37 +0000 (15:18 +0200)]
udev: fix path for database names on 'change' event

If a device does not have a major/minor number attached, we use different
database names than if it does. On "change" events, we didn't copy the
devnum over, therefore, we used different paths than on 'add' or 'remove'
events (where devnum was properly copied).

Fix this by always copying the devnum into the udev-device.

(David: added commit-log from email)

9 years agobus: fix bus_print_property() to use "int" for booleans
David Herrmann [Thu, 18 Sep 2014 11:28:28 +0000 (13:28 +0200)]
bus: fix bus_print_property() to use "int" for booleans

We always use "int" if we retrieve boolean values from sd-bus, as "bool"
is only a single byte, but full int on va-args.

Thanks to Werner Fink for the report!

9 years agoshared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMV
Tom Gundersen [Thu, 18 Sep 2014 11:47:00 +0000 (13:47 +0200)]
shared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMV

Found by Coverity. Fixes CID #1237746.

9 years agolibudev: monitor - warn if we fail to request SO_PASSCRED
Tom Gundersen [Thu, 18 Sep 2014 07:20:46 +0000 (09:20 +0200)]
libudev: monitor - warn if we fail to request SO_PASSCRED

The function still succeeds, so there is no functional change. This fixes CID #996288.

9 years agotests: fix resource & mem leaks
Ronny Chevalier [Thu, 18 Sep 2014 10:09:10 +0000 (12:09 +0200)]
tests: fix resource & mem leaks

9 years agosd-bus: sync kdbus.h
Daniel Mack [Thu, 18 Sep 2014 08:25:35 +0000 (10:25 +0200)]
sd-bus: sync kdbus.h

(no API/ABI break this time)

9 years agosystemctl: fix resource leak CID #1237747
Cristian Rodríguez [Thu, 18 Sep 2014 00:56:25 +0000 (21:56 -0300)]
systemctl: fix resource leak CID #1237747

..by simply moving the declaration of "unit" into the STRV_FOREACH
loop as suggested by Andreas.

9 years agoFix resource leak (coverity CID 1237760)
Cristian Rodríguez [Wed, 17 Sep 2014 21:10:21 +0000 (18:10 -0300)]
Fix resource leak (coverity CID 1237760)

9 years agosysv-generator: don't check first if hashmap contains the service name
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 21:03:27 +0000 (23:03 +0200)]
sysv-generator: don't check first if hashmap contains the service name

Just test if hashmap_get returns null. hashmap_contains does exactly
same thing internally so this is slightly more efficient for the true
case.

Silences a coverity warning too. CID#1237648

9 years agologind: fix typo
Ronny Chevalier [Wed, 17 Sep 2014 18:10:44 +0000 (20:10 +0200)]
logind: fix typo

9 years agoshared: conf-parser
Tom Gundersen [Wed, 17 Sep 2014 20:17:53 +0000 (22:17 +0200)]
shared: conf-parser

Check memory allocation. Found by Coverity.

Fixes CID #1237644.

9 years agoudev: event - modernize spawn_exec()
Tom Gundersen [Wed, 17 Sep 2014 19:53:20 +0000 (21:53 +0200)]
udev: event - modernize spawn_exec()

9 years agoudev: event - explicitly don't read() from invalid fd
Tom Gundersen [Wed, 17 Sep 2014 19:44:56 +0000 (21:44 +0200)]
udev: event - explicitly don't read() from invalid fd

This fixes CID #1237641.

9 years agoudev: event - modernize spawn_read()
Tom Gundersen [Wed, 17 Sep 2014 19:43:57 +0000 (21:43 +0200)]
udev: event - modernize spawn_read()

9 years agonss-resolve: remove dead code
Thomas Hindoe Paaboel Andersen [Wed, 17 Sep 2014 18:48:39 +0000 (20:48 +0200)]
nss-resolve: remove dead code

ifindex < 0 was already checked before entering the loop

Found by coverity. Fixes: CID#1237609

9 years agoudev: rules - close empty file
Tom Gundersen [Wed, 17 Sep 2014 17:53:01 +0000 (19:53 +0200)]
udev: rules - close empty file

If the file is found to be empty, we exit early without closing the file first.

Found by coverity. Fixes CID #1237759.

9 years agolibsystemd-network: dhcp-test - assert that malloc0 succeeds
Tom Gundersen [Wed, 17 Sep 2014 17:07:56 +0000 (19:07 +0200)]
libsystemd-network: dhcp-test - assert that malloc0 succeeds

Otherwise we would get a nullptr dereference later on.

Found by coverity. Fixes CID #1237655.

9 years agonetworkd: dhcp4 - fix unchecked return value
Tom Gundersen [Wed, 17 Sep 2014 17:00:55 +0000 (19:00 +0200)]
networkd: dhcp4 - fix unchecked return value

Found by coverity. CID #1237529 and #1237528.

9 years agobus: fix error leak in bus_node_exists()
David Herrmann [Wed, 17 Sep 2014 08:32:49 +0000 (10:32 +0200)]
bus: fix error leak in bus_node_exists()

If we call into user callbacks, we must always propagate possible errors.
Fix bus_node_exists() to do that and adjust the callers (which already
partially propagated the error).

Also speed up that function by first checking for registered enumerators
and/or object-managers.

9 years agobus: never respond to GetManagedObjects() on sub-paths
David Herrmann [Wed, 17 Sep 2014 07:28:09 +0000 (09:28 +0200)]
bus: never respond to GetManagedObjects() on sub-paths

The dbus-spec clearly specifies that GetManagedObjects() should only work
on the root-path of an object-tree. But on that path, it works regardless
whether there are any objects available or not.

We could, technically, define all sub-paths as a root-path of its own
sub-tree. However, if we do that, we enter undefined territory:

    Imagine only a fallback vtable is registered. We want
    GetManagedObjects() to *NOT* fail with UNKNOWN_METHOD if it is called
    on a valid sub-tree of the fallback. On the other hand, we don't want
    it to work on arbitrary sub-tree. Something like:
        /path/to/fallback/foobar/foobar/foobar/invalid/foobar
    should not work.
    However, there is no way to know which paths on a fallback are valid
    without looking at there registered objects. If no objects are
    registered, we have no way to figure it out.

Therefore, we now try to follow the dbus spec by only returning valid data
on registered root-paths. We treat each path as root which was registered
an object-manager on via add_object_manager(). So applications can now
directly control which paths to place an object-manager on.

We also fix the introspection to not return object-manager interfaces on
non-root paths.

Also fixes some dead-code paths initially reported by Philippe De Swert.

9 years agosysctl: make --prefix allow all kinds of sysctl paths
David Herrmann [Wed, 17 Sep 2014 07:06:49 +0000 (09:06 +0200)]
sysctl: make --prefix allow all kinds of sysctl paths

Currently, we save arguments passed as --prefix directly and compare them
later to absolute sysctl file-system paths. That is, you are required to
specify arguments to --prefix with leading /proc/sys/. This is kinda
uselesss. Furthermore, we replace dots by slashes in the name, which makes
it impossible to match on specific sysfs paths that have dots in their
name (like netdev names). The intention of this argument is clear, but it
never worked as expected.

This patch modifies --prefix to accept any kind of sysctl paths. It
supports paths prefixed with /proc/sys for compatibility (but drops the
erroneous dot->slash conversion), but instead applies normalize_sysctl()
which turns any name or path into a proper path. It then appends
/proc/sys/ so we can properly use it in matches.

Thanks to Jan Synacek <jsynacek@redhat.com> for catching this!

9 years agoutil: remove a unnecessary check
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 20:58:35 +0000 (22:58 +0200)]
util: remove a unnecessary check

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

9 years agoterminal: remove dead code checking O_WRONLY
David Herrmann [Tue, 16 Sep 2014 21:00:26 +0000 (23:00 +0200)]
terminal: remove dead code checking O_WRONLY

We only reject evdev FDs that are O_WRONLY as they're currently pretty
useless. The following check for O_WRONLY is thus never excercised so drop
it.
Thanks to Thomas Andersen (via coverity)!

9 years agotest: silence a coverity report
Thomas Hindoe Paaboel Andersen [Tue, 16 Sep 2014 19:59:50 +0000 (21:59 +0200)]
test: silence a coverity report

We check the actual contents of the file on the line after but we
might as well also check the number of bytes read here.

Found by coverity. Fixes: CID#1237521

9 years agoshared: fix resource leak in config_parse_default_instance
Andreas Henriksson [Tue, 16 Sep 2014 19:36:26 +0000 (21:36 +0200)]
shared: fix resource leak in config_parse_default_instance

The recently allocated "printed" is not freed on error path.

Found by coverity. Fixes: CID#1237745