[Bug 215097] 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

--- Comment #3 from Alejandro Colomar (man-pages) (alx.manpages@xxxxxxxxx) ---
Makes sense.  Fixed.
I'll keep the bug open until I fix sysconf(3) too.

Thanks!
Alex

    getpwnam.3: EXAMPLES: Fix signedness

    sysconf(3) returns a long.  Since it can return -1 (and we're
    making use of that value), we can't use size_t for bufsize.
    Use long.

    Link: <https://bugzilla.kernel.org/show_bug.cgi?id=215097>
    Reported-by: Fabian <fabian@xxxxxxxxxxxxxx>
    Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>

diff --git a/man3/getpwnam.3 b/man3/getpwnam.3
index 71457a916..8ca13f1a2 100644
--- a/man3/getpwnam.3
+++ b/man3/getpwnam.3
@@ -304,7 +304,7 @@ main(int argc, char *argv[])
     struct passwd pwd;
     struct passwd *result;
     char *buf;
-    size_t bufsize;
+    long bufsize;
     int s;

     if (argc != 2) {

-- 
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