Commit graph

17262 commits

Author SHA1 Message Date
Emil Renner Berthing 8e8af4cfc7 shared/sparse-endian.h: add missing byteswap.h include 2014-09-19 00:27:42 +02:00
Emil Renner Berthing 45f15021e3 shared/label.h: add missing stdio.h include 2014-09-19 00:26:49 +02:00
David Herrmann fb1f4170d0 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.
2014-09-19 00:26:49 +02:00
Thomas Hindoe Paaboel Andersen 66a16e7e9f 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
2014-09-19 00:15:39 +02:00
Tom Gundersen 2f905e821e timesyncd: check return of setting IP_TOS
Fonud by Coverity. Fixes CID #1237534.
2014-09-18 23:37:07 +02:00
Tom Gundersen 25773e7fc5 udevd: don't fail if /run/udev exists 2014-09-18 21:57:49 +02:00
Tom Gundersen 65fea570f0 udev: fix typos
Spotted by Andreas Henriksson.
2014-09-18 20:25:33 +02:00
Tom Gundersen 4bbdff757e udev: ctrl - log if setting SO_PASSCRED fails
No functional change.

Found by Coverity. Fixes CID #1237533.
2014-09-18 19:26:11 +02:00
Tom Gundersen 543afdc63c udev: node - warn if chmod/chown fails
No functional change, just log the warning.

Fonud by Coverity. Fixes CID #1237544.
2014-09-18 19:22:09 +02:00
Tom Gundersen f901aaadd6 udevadm: hwdb - check return value of fseeko()
Fonud by Coverity. Fixes CID #996255.
2014-09-18 19:16:54 +02:00
Tom Gundersen d457ff8319 udevd: check return of various functions
One reported by Coverity. Fixes CID #996252.
2014-09-18 19:10:23 +02:00
Tom Gundersen 6f5cf8a8b1 udevd: parse_argv - warn if argumens are invalid
Found by Coverity. Fixes CID #1238780.
2014-09-18 19:02:42 +02:00
Andreas Henriksson b1604b341b 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
2014-09-18 18:33:44 +02:00
Philippe De Swert 56d21cdebc sysusers: Remove some gcc warnings about uninitialized variables
Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.
2014-09-18 18:32:18 +02:00
Philippe De Swert 96f2f3b1b5 core: Remove uninitialized warnings from bus-endpoint.c
Gcc is spewing some warnings about uninitialized variables.
Let's get rid of the noise.
2014-09-18 18:32:18 +02:00
Philippe De Swert b88a40a7e5 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).
2014-09-18 18:32:18 +02:00
Emil Renner Berthing 141a1ceaa6 mount: order options before other arguments to mount 2014-09-18 18:12:51 +02:00
Emil Renner Berthing fdb8bd0fe7 include fcntl.h rather than sys/fcntl.h 2014-09-18 17:59:15 +02:00
Emil Renner Berthing 1ed96046cb sd-rtnl: rtnl-message: remove unneeded linux includes 2014-09-18 17:37:55 +02:00
Emil Renner Berthing 58c9846d32 udev: link-config: remove unneded linux/netdevice.h include 2014-09-18 17:36:20 +02:00
Philippe De Swert e8c108ca9f 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
2014-09-18 15:40:45 +02:00
Michael Marineau fb7661a602 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.
2014-09-18 15:38:00 +02:00
Robert Milasan 572016d1c2 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)
2014-09-18 15:28:07 +02:00
David Herrmann c2fa048c4a 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!
2014-09-18 13:57:13 +02:00
Tom Gundersen 77c10205bb shared: conf-parser - don't leak memory on error in DEFINE_CONFIG_PARSE_ENUMV
Found by Coverity. Fixes CID #1237746.
2014-09-18 13:48:44 +02:00
Tom Gundersen 9dedfe7f66 libudev: monitor - warn if we fail to request SO_PASSCRED
The function still succeeds, so there is no functional change. This fixes CID #996288.
2014-09-18 13:48:44 +02:00
Ronny Chevalier 76082570b8 tests: fix resource & mem leaks 2014-09-18 12:09:10 +02:00
Daniel Mack 913b6d70cb sd-bus: sync kdbus.h
(no API/ABI break this time)
2014-09-18 10:25:38 +02:00
Cristian Rodríguez 48a2900c66 systemctl: fix resource leak CID #1237747
..by simply moving the declaration of "unit" into the STRV_FOREACH
loop as suggested by Andreas.
2014-09-18 10:16:23 +02:00
Cristian Rodríguez 4edf33d1e3 Fix resource leak (coverity CID 1237760) 2014-09-18 10:13:09 +02:00
Thomas Hindoe Paaboel Andersen 8c84621c25 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
2014-09-17 23:11:58 +02:00
Ronny Chevalier 2b2332856b logind: fix typo 2014-09-17 22:41:05 +02:00
Tom Gundersen 83e341a637 shared: conf-parser
Check memory allocation. Found by Coverity.

Fixes CID #1237644.
2014-09-17 22:19:53 +02:00
Tom Gundersen 19c784c414 udev: event - modernize spawn_exec() 2014-09-17 22:19:53 +02:00
Tom Gundersen 3f796750b1 udev: event - explicitly don't read() from invalid fd
This fixes CID #1237641.
2014-09-17 22:19:53 +02:00
Tom Gundersen 4cd5d5adb6 udev: event - modernize spawn_read() 2014-09-17 22:19:53 +02:00
Thomas Hindoe Paaboel Andersen 4eef5b7441 nss-resolve: remove dead code
ifindex < 0 was already checked before entering the loop

Found by coverity. Fixes: CID#1237609
2014-09-17 20:50:36 +02:00
Tom Gundersen 6c8aaf0c1b 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.
2014-09-17 19:55:23 +02:00
Tom Gundersen 6f42877282 libsystemd-network: dhcp-test - assert that malloc0 succeeds
Otherwise we would get a nullptr dereference later on.

Found by coverity. Fixes CID #1237655.
2014-09-17 19:13:35 +02:00
Tom Gundersen f414a269b3 networkd: dhcp4 - fix unchecked return value
Found by coverity. CID #1237529 and #1237528.
2014-09-17 19:13:35 +02:00
David Herrmann ff02f101cb 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.
2014-09-17 11:01:56 +02:00
David Herrmann 943c3f94e2 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.
2014-09-17 11:01:52 +02:00
David Herrmann 0e1f579227 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!
2014-09-17 09:11:02 +02:00
Thomas Hindoe Paaboel Andersen 42646a8bf2 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
2014-09-16 23:03:50 +02:00
David Herrmann 1164e944d9 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)!
2014-09-16 23:01:48 +02:00
Thomas Hindoe Paaboel Andersen cca0efb047 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
2014-09-16 22:02:23 +02:00
Andreas Henriksson d9ab174bd7 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
2014-09-16 21:49:56 +02:00
Andreas Henriksson 91e7bad45d sysv-generator: fix resource leak
The "unit" string allocation is not freed on either error or success path.

Found by coverity. Fixes: CID#1237755
2014-09-16 21:49:03 +02:00
Andreas Henriksson aa9f8a30fd core: fix resource leak in manager_environment_add
Second error path must free the (potentially) allocated memory in the
first code chunk before returning.

Found by coverity. Fixes: CID#1237750
2014-09-16 21:47:24 +02:00
Cristian Rodríguez 06b7f7bd7f missing: memfd_create takes unsigned int flags in final version 2014-09-16 21:46:14 +02:00