freebsd-dev/usr.sbin/ctladm
Dimitry Andric b0c39ce916 In usr.sbin/ctladm/ctladm.c, function cctl_error_inject(), initialize
the 'retval' variable to zero, to avoid returning garbage in several
cases.

This fixes the following clang 3.2 warnings:

  usr.sbin/ctladm/ctladm.c🔢6: error: variable 'retval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
          if (ioctl(fd, CTL_ERROR_INJECT, &err_desc) == -1) {
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  usr.sbin/ctladm/ctladm.c:1243:10: note: uninitialized use occurs here
          return (retval);
                  ^~~~~~
  usr.sbin/ctladm/ctladm.c🔢2: note: remove the 'if' if its condition is always true
          if (ioctl(fd, CTL_ERROR_INJECT, &err_desc) == -1) {
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  usr.sbin/ctladm/ctladm.c:1161:7: error: variable 'retval' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
                  if (ioctl(fd, CTL_ERROR_INJECT_DELETE, &err_desc) == -1) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  usr.sbin/ctladm/ctladm.c:1243:10: note: uninitialized use occurs here
          return (retval);
                  ^~~~~~
  usr.sbin/ctladm/ctladm.c:1161:3: note: remove the 'if' if its condition is always true
                  if (ioctl(fd, CTL_ERROR_INJECT_DELETE, &err_desc) == -1) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  usr.sbin/ctladm/ctladm.c:1029:12: note: initialize the variable 'retval' to silence this warning
          int retval;
                    ^
                     = 0

MFC after:      1 week
2012-08-05 17:23:47 +00:00
..
ctladm.8 Minor spelling fixes. 2012-06-03 11:29:48 +00:00
ctladm.c In usr.sbin/ctladm/ctladm.c, function cctl_error_inject(), initialize 2012-08-05 17:23:47 +00:00
ctladm.h
Makefile
util.c