[binutils-gdb] libctf, types: ensure the emission of ECTF_NOPARENT

Nick Alcock nix@sourceware.org
Wed Jul 22 17:10:15 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b7190c821e529d7858cff7c2fcc57304a1d38d2b

commit b7190c821e529d7858cff7c2fcc57304a1d38d2b
Author: Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com>
Date:   Wed Jun 3 17:36:51 2020 +0100

    libctf, types: ensure the emission of ECTF_NOPARENT
    
    ctf_variable_iter was returning a (positive!) error code rather than
    setting the error in the passed-in ctf_file_t.
    
    Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
    
    libctf/
            * ctf-types.c (ctf_variable_iter): Fix error return.

Diff:
---
 libctf/ChangeLog   | 4 ++++
 libctf/ctf-types.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libctf/ChangeLog b/libctf/ChangeLog
index 45caf217cb2..f3ac4cc91e7 100644
--- a/libctf/ChangeLog
+++ b/libctf/ChangeLog
@@ -1,3 +1,7 @@
+2020-07-22  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
+
+	* ctf-types.c (ctf_variable_iter): Fix error return.
+
 2020-07-22  Nick Alcock  <nick.alcock@oracle.com>
 
 	* ctf-open.c (ctf_bufopen_internal): Diagnose invalid flags.
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c
index d7ed0e31dca..550068250fd 100644
--- a/libctf/ctf-types.c
+++ b/libctf/ctf-types.c
@@ -495,7 +495,7 @@ ctf_variable_iter (ctf_file_t *fp, ctf_variable_f *func, void *arg)
   int rc;
 
   if ((fp->ctf_flags & LCTF_CHILD) && (fp->ctf_parent == NULL))
-    return ECTF_NOPARENT;
+    return (ctf_set_errno (fp, ECTF_NOPARENT));
 
   if (!(fp->ctf_flags & LCTF_RDWR))
     {


More information about the Binutils-cvs mailing list