]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix 402395 coregrind/vgdb-invoker-solaris.c: 2 * poor error checking
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 23 Dec 2018 13:49:25 +0000 (14:49 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 23 Dec 2018 13:49:25 +0000 (14:49 +0100)
2 size_t variables were used as return value of read syscalls,
while ssize_t must be used.

NEWS
coregrind/vgdb-invoker-solaris.c

diff --git a/NEWS b/NEWS
index e1645eff08239116c0a0f99877325a9c9fa359e5..18ee9d59486b8e81298621e8f763de18c49a3683 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -74,6 +74,7 @@ where XXXXXX is the bug number as listed below.
 402048  WARNING: unhandled ppc64[be|le]-linux syscall: 26 (ptrace)
 402134  assertion fail in mc_translate.c (noteTmpUsesIn) Iex_VECRET on arm64
 402327  Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x13 (DW_OP_drop)
+402395  coregrind/vgdb-invoker-solaris.c: 2 * poor error checking
 
 Release 3.14.0 (9 October 2018)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 8185e704f9065afdee7598e3c054a84e59ae2645..b62902b950e682da15965b36955666cecee41c96 100644 (file)
@@ -173,8 +173,8 @@ static Bool attach(pid_t pid)
    }
 
    pstatus_t pstatus;
-   bytes = read(status_fd, &pstatus, sizeof(pstatus));
-   if ((bytes < 0) || (bytes != sizeof(pstatus))) {
+   ssize_t nread = read(status_fd, &pstatus, sizeof(pstatus));
+   if ((nread < 0) || (nread != sizeof(pstatus))) {
       ERROR(errno, "Failed to read from %s.\n", procname);
       close(status_fd);
       return False;
@@ -400,8 +400,8 @@ static Bool invoke_agent(pid_t pid, prgregset_t *regs, id_t *agent_lwpid)
    }
 
    lwpstatus_t status;
-   bytes = read(status_fd, &status, sizeof(status));
-   if ((bytes < 0) || (bytes != sizeof(status))) {
+   ssize_t nread = read(status_fd, &status, sizeof(status));
+   if ((nread < 0) || (nread != sizeof(status))) {
       ERROR(errno, "Failed to read from %s.\n", procname);
       close(status_fd);
       return False;