r205667 - [analyzer] Add an ErrnoChecker (PR18701) to the Potential Checkers list.

Richard Osborne richard at xmos.com
Sat Apr 5 03:43:26 PDT 2014


On 5 Apr 2014, at 07:10, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> +#include <stdlib.h>
> +
> +int readWrapper(int fd, int *count) {
> +  int lcount = read(fd, globalBuf, sizeof(globalBuf));
> +  if (lcount < 0)
> +    return errno;
> +  *count = lcount;
> +  return 0;
> +}
> +
> +void use(int fd) {
> +  int count;
> +  if (!readWrapper(fd))
Should this be:

if (!readWrapper(fd, &count))

> +    print("%d", count); // should not warn
> +}





More information about the cfe-commits mailing list