Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
langc
int do_xyz(void); 
 
int f(void) {
/* ... */
  if (do_xyz) { 
    return -1; /* handle error Indicate failure */ 
  }
/* ... */
  return 0;
} 

Compliant Solution

In this compliant solution, the function do_xyz() is invoked and the return value is compared to 0:

Code Block
bgColor#ccccff
langc
int do_xyz(void); 
 
int f(void) {
/* ... */ 
  if (do_xyz()) { 
    return -1; /* handle errorIndicate failure */
/* ... */
  return 0;  
} 

Risk Assessment

Errors of omission can result in unintended program flow.

...