Ticket #1044 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

Incorrect variable assignment in create_socket_symlink

Reported by: sgallagh Owned by: jhrozek
Priority: minor Milestone: SSSD 1.5.14
Component: SSSD Version: 1.6.1
Keywords: Coverity Cc:
Blocked By: Blocking:
Tests Updated: no Coverity Bug: 11048
Patch Submitted: no Red Hat Bugzilla: 0
Design link:
Feature Milestone:
Design review: Fedora test page:
Chosen: Candidate to push out:
Release Notes:

Description

 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        }

Change History

comment:1 Changed 3 years ago by sgallagh

  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 2 years ago by dpal

  • Red Hat Bugzilla set to 0
Note: See TracTickets for help on using tickets.