[MDEV-6820] prototype for SHOW_FUNC handler declared as return int but return value ignored? Created: 2014-10-01  Updated: 2022-09-08

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.14
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Hartmut Holzgraefe Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: upstream


 Description   

Description:
The mysql_show_var_func typedef for SHOW_FUNC callback handlers is
declared as returning "int", but at the two places where it gets called
in SHOW STATUS handling its return value is completely ignored.

Also the documentation mentions that it should return int (by showing
the typedef prototype) but doesn't mention what to return at all.

How to repeat:
Check ./include/mysql/plugin.h:

  typedef int (*mysql_show_var_func)(MYSQL_THD, struct
st_mysql_show_var*, char *);
 
vs. sql/sql_show.cc
 
  /*
  if var->type is SHOW_FUNC, call the function.
  Repeat as necessary, if new var is again SHOW_FUNC
  */
  SHOW_VAR tmp;
  for (; list->type == SHOW_FUNC; list= &tmp)
    ((mysql_show_var_func)(list->value))(thd, &tmp, value);

and

  /*
    if var->type is SHOW_FUNC or SHOW_SIMPLE_FUNC, call the function.  
     
    Repeat as necessary, if new var is again one of the above
  */                                                                   
     
  for (var=variables; var->type == SHOW_FUNC ||                        
     
         var->type == SHOW_SIMPLE_FUNC; var= &tmp)                     
     
    ((mysql_show_var_func)(var->value))(thd, &tmp, buff);              

Suggested fix:
The return value was probably meant to signal errors?

So implement actual error checking where mysql_show_var_func is called?



 Comments   
Comment by Hartmut Holzgraefe [ 2014-10-01 ]

Also filed as http://bugs.mysql.com/74159

Generated at Thu Feb 08 07:14:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.