<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 31, 2021 at 11:13 AM Gedare Bloom <<a href="mailto:gedare@rtems.org">gedare@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Mar 31, 2021 at 9:16 AM Ryan Long <<a href="mailto:ryan.long@oarcorp.com" target="_blank">ryan.long@oarcorp.com</a>> wrote:<br>
><br>
> CID 1049146: Unchecked return value from library in get_clock().<br>
> CID 1049147: Unchecked return value from library in get_random_fd().<br>
><br>
> Closes #4280<br>
> ---<br>
>  cpukit/libmisc/uuid/gen_uuid.c | 8 ++++++++<br>
>  1 file changed, 8 insertions(+)<br>
><br>
> diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c<br>
> index 3ca75a0..9cd763d 100644<br>
> --- a/cpukit/libmisc/uuid/gen_uuid.c<br>
> +++ b/cpukit/libmisc/uuid/gen_uuid.c<br>
> @@ -164,8 +164,13 @@ static int get_random_fd(void)<br>
>                         fd = open("/dev/random", O_RDONLY | O_NONBLOCK);<br>
>                 if (fd >= 0) {<br>
>                         i = fcntl(fd, F_GETFD);<br>
> +                       #ifdef __rtems__<br>
> +                       if (i >= 0)<br>
> +                               (void) fcntl(fd, F_SETFD, i | FD_CLOEXEC);<br>
> +                       #else<br>
>                         if (i >= 0)<br>
>                                 fcntl(fd, F_SETFD, i | FD_CLOEXEC);<br>
> +                       #endif<br>
You could do the same thing here as you did below, just put the #ifdef<br>
after the if (i>=0)<br>
<br>
The upstream is<br>
<a href="https://github.com/karelzak/util-linux/blob/master/libuuid/src/gen_uuid.c" rel="noreferrer" target="_blank">https://github.com/karelzak/util-linux/blob/master/libuuid/src/gen_uuid.c</a><br>
I wonder if we should update?<br></blockquote><div><br></div><div>Are you sure that's the master? That's not what the README in the directory says.</div><div><br></div><div>I'm not opposed to updating the code in the directory but I want to make sure it</div><div>comes from the right place. </div><div><br></div><div>And do we have any tests to ensure it works if it builds? This wasn't included</div><div>in the last coverage I uploaded but I can ask Alex to turn it on.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
>                 }<br>
>  #endif<br>
>                 srand((getpid() << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);<br>
> @@ -426,6 +431,9 @@ try_again:<br>
>                 }<br>
>                 rewind(state_f);<br>
>                 fl.l_type = F_UNLCK;<br>
> +       #ifdef __rtems__<br>
> +               (void)<br>
> +       #endif<br>
>                 fcntl(state_fd, F_SETLK, &fl);<br>
>         }<br>
><br>
> --<br>
> 1.8.3.1<br>
><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div></div>