Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-3545

Comparison of integer expressions of different signedness

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: 3.12.7, 3.15.4, 3.18.0
    • Fix Version/s: None
    • Component/s: cf-agent
    • Labels:
      None

      Description

      We should not use '-1' in combination with an unsigned type.

       

      verify_exec.c: In function ‘RepairExec’:
      verify_exec.c:255:26: error: comparison of integer expressions of different signedness: ‘uid_t’ {aka ‘const unsigned int’} and ‘int’ [-Werror=sign-compare]
        255 |     if (a->contain.owner != -1)
            |                          ^~
      verify_exec.c:261:26: error: comparison of integer expressions of different signedness: ‘gid_t’ {aka ‘const unsigned int’} and ‘int’ [-Werror=sign-compare]
        261 |     if (a->contain.group != -1)
            |                          ^~

      core/cf-agent/verify_exec.c : 255

          char owner_str[CF_BUFSIZE] = "";
          if (a->contain.owner != -1)
          {
              snprintf(owner_str, CF_BUFSIZE, ",uid=%ju", (uintmax_t)a->contain.owner);
          }
      

      core/cf-agent/verify_exec.c :261

          char group_str[CF_BUFSIZE] = "";
          if (a->contain.group != -1)
          {
              snprintf(group_str, CF_BUFSIZE, ",gid=%ju", (uintmax_t)a->contain.group);
          }
      

       

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              larsewi Lars Erik Wik
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel