Re: [systemd-devel] [systemd-commits] src/udev

2015-03-09 Thread Tom Gundersen
Makes sense. Made some changes now.

On Mon, Mar 9, 2015 at 6:06 PM, Lennart Poettering
 wrote:
> On Mon, 09.03.15 10:00, Tom Gundersen (tome...@kemper.freedesktop.org) wrote:
>
>> +static void event_queue_update(void) {
>> +if (!udev_list_node_is_empty(&event_list)) {
>> +int fd;
>> +
>> +fd = open("/run/udev/queue", 
>> O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
>> +if (fd >= 0)
>> +   close(fd);
>
> Isn't this a candidate for touch() or touch_file()?
>
>> +} else
>> +unlink("/run/udev/queue");
>> +}
>
> Not that it would matter much, but I think we should generally prefix
> syscalls whose return code we ignore knowingly with a (void) cast, so
> that Coverity doesn't ever get the idea we'd ignore the return value
> by accident...
>
> Lennart
>
> --
> Lennart Poettering, Red Hat
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [systemd-commits] src/udev

2015-03-09 Thread Lennart Poettering
On Mon, 09.03.15 10:00, Tom Gundersen (tome...@kemper.freedesktop.org) wrote:

> +static void event_queue_update(void) {
> +if (!udev_list_node_is_empty(&event_list)) {
> +int fd;
> +
> +fd = open("/run/udev/queue", 
> O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
> +if (fd >= 0)
> +   close(fd);

Isn't this a candidate for touch() or touch_file()?

> +} else
> +unlink("/run/udev/queue");
> +}

Not that it would matter much, but I think we should generally prefix
syscalls whose return code we ignore knowingly with a (void) cast, so
that Coverity doesn't ever get the idea we'd ignore the return value
by accident...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel