[Bug 215097] New: Example in getpwnam_r man page compares size_t variable to -1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.kernel.org/show_bug.cgi?id=215097

            Bug ID: 215097
           Summary: Example in getpwnam_r man page compares size_t
                    variable to -1
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: low
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages@xxxxxxxxxxxxxxxxxxxx
          Reporter: fabian@xxxxxxxxxxxxxx
        Regression: No

The getpwnam_r man page
(https://man7.org/linux/man-pages/man3/getpwnam_r.3.html) has this in the
example code:

           size_t bufsize;
           ...

           bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
           if (bufsize == -1)          /* Value was indeterminate */
               bufsize = 16384;        /* Should be more than enough */

bufsize is a variable with unsigned type, so this results in:

mantest.c: In function 'main':
mantest.c:14:20: warning: comparison of integer expressions of different
signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |         if(bufsize == -1)

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux