[PATCH 1/3] gen_uuid.c: Ignore return values from fcntl()
Ryan Long
ryan.long at oarcorp.com
Wed Mar 31 15:16:18 UTC 2021
CID 1049146: Unchecked return value from library in get_clock().
CID 1049147: Unchecked return value from library in get_random_fd().
Closes #4280
---
cpukit/libmisc/uuid/gen_uuid.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c
index 3ca75a0..9cd763d 100644
--- a/cpukit/libmisc/uuid/gen_uuid.c
+++ b/cpukit/libmisc/uuid/gen_uuid.c
@@ -164,8 +164,13 @@ static int get_random_fd(void)
fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
if (fd >= 0) {
i = fcntl(fd, F_GETFD);
+ #ifdef __rtems__
+ if (i >= 0)
+ (void) fcntl(fd, F_SETFD, i | FD_CLOEXEC);
+ #else
if (i >= 0)
fcntl(fd, F_SETFD, i | FD_CLOEXEC);
+ #endif
}
#endif
srand((getpid() << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
@@ -426,6 +431,9 @@ try_again:
}
rewind(state_f);
fl.l_type = F_UNLCK;
+ #ifdef __rtems__
+ (void)
+ #endif
fcntl(state_fd, F_SETLK, &fl);
}
--
1.8.3.1
More information about the devel
mailing list