[rtems commit] gen_uuid.c: Revert previous patch ( 597e4f476568a225d14dfaff02074cf269ad62ac)

Joel Sherrill joel at rtems.org
Wed Mar 24 13:03:20 UTC 2021


Module:    rtems
Branch:    master
Commit:    62bbb0cc46f5015e757bae866e0b1aedd33d7d9d
Changeset: http://git.rtems.org/rtems/commit/?id=62bbb0cc46f5015e757bae866e0b1aedd33d7d9d

Author:    Joel Sherrill <joel at rtems.org>
Date:      Wed Mar 24 07:57:43 2021 -0500

gen_uuid.c: Revert previous patch (597e4f476568a225d14dfaff02074cf269ad62ac)

The patch was:
    gen_uuid.c: Fix two Unchecked return value from library errors

    CID 1049146: Unchecked return value from library in get_clock().
    CID 1049147: Unchecked return value from library in get_random_fd().

 Reopen #4280

---

 cpukit/libmisc/uuid/gen_uuid.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/cpukit/libmisc/uuid/gen_uuid.c b/cpukit/libmisc/uuid/gen_uuid.c
index 5bb34c0..3ca75a0 100644
--- a/cpukit/libmisc/uuid/gen_uuid.c
+++ b/cpukit/libmisc/uuid/gen_uuid.c
@@ -155,7 +155,6 @@ static int get_random_fd(void)
 	struct timeval	tv;
 	static int	fd = -2;
 	int		i;
-	int		sc;
 
 	if (fd == -2) {
 		gettimeofday(&tv, 0);
@@ -165,10 +164,8 @@ static int get_random_fd(void)
 			fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
 		if (fd >= 0) {
 			i = fcntl(fd, F_GETFD);
-			if (i >= 0) {
-				sc = fcntl(fd, F_SETFD, i | FD_CLOEXEC);
-				_Assert_Unused_variable_unequal(sc, -1);
-			}
+			if (i >= 0)
+				fcntl(fd, F_SETFD, i | FD_CLOEXEC);
 		}
 #endif
 		srand((getpid() << ((sizeof(pid_t)*CHAR_BIT)>>1)) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
@@ -337,7 +334,6 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
 	uint64_t			clock_reg;
 	mode_t				save_umask;
 	int				len;
-	int				sc;
 
 	if (state_fd == -2) {
 		save_umask = umask(0);
@@ -430,8 +426,7 @@ try_again:
 		}
 		rewind(state_f);
 		fl.l_type = F_UNLCK;
-		sc = fcntl(state_fd, F_SETLK, &fl);
-		_Assert_Unused_variable_unequal(sc, -1);
+		fcntl(state_fd, F_SETLK, &fl);
 	}
 
 	*clock_high = clock_reg >> 32;



More information about the vc mailing list