Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added cs for comparing a function pointer to a null pointer of the same type

...

Code Block
bgColor#ccccff
/* First the options that are only allowed for root */
if (getuid() == 0 || geteuid() != 0) {
  /* ... */
}

Compliant Code Example

A function pointer can be compared to a null function pointer of the same type.

Code Block
bgColor#ccccff

/* First the options that are only allowed for root */ 
if (getuid == (uid_t(*)(void))0 || geteuid != (uid_t(*)(void))0) { 
  /* ... */ 
} 

This code should not be diagnosed by an analyzer.

Noncompliant Code Example

...