[systemd-devel] [PATCH] udev: Do not try to start worker if it cannot not recieve events

David Herrmann dh.herrmann at gmail.com
Thu Nov 20 04:05:25 PST 2014


Hi

On Tue, Nov 18, 2014 at 12:17 PM,  <philippedeswert at gmail.com> wrote:
> From: Philippe De Swert <philippe.deswert at jollamobile.com>
>
> udev_monitor_enable_receiving() enables a udev_monitor to recieve
> events. If this fails, the worker here created most likely won't
> recieve any events and will probably not be very useful. So now
> we check if the event recieving is activated before creating the
> new worker.
>
> Found with Coverity: CID#996477
> ---
>  src/udev/udevd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/udev/udevd.c b/src/udev/udevd.c
> index 3c3de76..d46ddcc 100644
> --- a/src/udev/udevd.c
> +++ b/src/udev/udevd.c
> @@ -183,7 +183,8 @@ static void worker_new(struct event *event) {
>                  return;
>          /* allow the main daemon netlink address to send devices to the worker */
>          udev_monitor_allow_unicast_sender(worker_monitor, monitor);
> -        udev_monitor_enable_receiving(worker_monitor);
> +        if(!udev_monitor_enable_receiving(worker_monitor))
> +                return;

udev_monitor_enable_receiving() returns 0 on success, negative error
code on failure. This patch would bail out on success, which is
probably not what you want.

Thanks
David

>          worker = new0(struct worker, 1);
>          if (worker == NULL) {
> --
> 1.8.3.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list