#1044 Incorrect variable assignment in create_socket_symlink

Created 6 years ago by sgallagh
Modified 8 months ago

 95static errno_t
  96create_socket_symlink(const char *filename, const char *symlink_filename)
  97{
  98    errno_t ret;
  99
 100    DEBUG(7, ("Symlinking the dbus path %s to a link %s\n",
 101              filename, symlink_filename));
 102    errno = 0;
 103    ret = symlink(filename, symlink_filename);
 104    if (ret != 0 && errno == EEXIST) {
 105        /* Perhaps cruft after a previous server? */
CID 11048: Argument cannot be negative (NEGATIVE_RETURNS)Function "unlink(symlink_filename)" returns a negative number.
Assigning: signed variable "ret" = "unlink".
 106        ret = unlink(symlink_filename);
At conditional (1): "ret != 0" taking the true branch.
 107        if (ret != 0) {
At conditional (2): "debug_level & __debug_macro_newlevel" taking the true branch.
At conditional (3): "debug_timestamps" taking the true branch.
At conditional (4): "debug_microseconds" taking the true branch.
"ret" is passed to a parameter that cannot be negative.
 108            DEBUG(1, ("Cannot remove old symlink: [%d][%s].\n",
 109                      ret, strerror(ret)));
 110            return EIO;
 111        }

Fixed by:
- 8cfaeff (master)
- 3deb85e (sssd-1-6)
- d62db6e (sssd-1-5)

resolution: => fixed
status: new => closed

Fields changed

rhbz: => 0

8 months ago

Metadata Update from @sgallagh:
- Issue assigned to jhrozek
- Issue set to the milestone: SSSD 1.5.14

Login to comment on this ticket.

defect

SSSD

1.6.1

0

0

0

Coverity

11048

cancel