summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-device/device-private.c
AgeCommit message (Collapse)Author
2015-09-30tree-wide: remove a number of invocations of strerror() and replace by %mLennart Poettering
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
2015-07-29tree-wide: port everything over to fflush_and_check()Lennart Poettering
Some places invoked fflush() directly with their own manual error checking, let's unify all that by using fflush_and_check(). This also unifies the general error paths of fflush()+rename() file writers.
2015-06-01sd-device: ensure update_properties_buf() is a noop on failureTom Gundersen
Don't clobber the sd_device struct, and don't leak memory when memory allocation fails.
2015-06-01sd-device: fix invalid property strv pointersMartin Pitt
In device_update_properties_bufs(), the strv is built from pointers into the single nul-terminated buf_nulstr string, to avoid allocating the key=value strings twice. However, we must not do that while building and GREEDY_REALLOC0()'ing buf_nulstr, as each time when this actually reallocates memory the pointers we wrote into buf_strv so far become invalid. So change the logic to first completely build the new buf_nulstr, and then iterate over it to pick out the pointers to the individual key=value strings for properties_strv. This fixes invalid environment for udev callouts.
2015-05-27sd-device: fix device_get_properties_strv()Tom Gundersen
A NULL pointer was inserted as the first element of the strv. This had the effect of always passing the empty environment to processes spawned by udev. Reported by Michał Bartoszkiewicz.
2015-04-23udevd: fix REMOVE handlingTom Gundersen
This reverts b67f944. Lazy loading of device properties does not work for devices that are received over netlink, as these are sealed. Reinstate the unconditional loading of the device db. Reported by: Mantas Mikulėnas <grawity@gmail.com>.
2015-04-05sd-device: don't use alloca() within loopsTom Gundersen
I shall not use alloca() within loops I shall not use alloca() within loops I shall not use alloca() within loops I shall not use alloca() within loops ...
2015-04-03sd-device,udevd: fix spelling /ammend/amend/Tom Gundersen
2015-04-03sd-device: fix deserialization from netlinkTom Gundersen
Use the standard FOREACH_WORD* macros. The current code was broken in the devlink case so the last one received was being dropped, causing https://bugs.freedesktop.org/show_bug.cgi?id=89894
2015-04-03sd-device: get_properties_{nulstr,strv} - don't recreate the buffer ↵Tom Gundersen
unnecessarily
2015-04-02libsystemd: add sd-device libraryTom Gundersen
This provides equivalent functionality to libudev-device, but in the systemd style. The public API only caters to creating sd_device objects from for devices that already exist in /sys, there is no support for listening for monitoring events or creating devices received over the udev netlink protocol. The private API contains the necessary functionality to make sd-device a drop-in replacement for libudev-device, but which we would not otherwise want to export.