public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugzilla.kernel.org
To: linux-man@vger.kernel.org
Subject: [Bug 215097] Example in getpwnam_r man page compares size_t variable to -1
Date: Tue, 23 Nov 2021 11:46:53 +0000	[thread overview]
Message-ID: <bug-215097-11311-uVLQZArsvJ@https.bugzilla.kernel.org/> (raw)
In-Reply-To: <bug-215097-11311@https.bugzilla.kernel.org/>

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

--- Comment #3 from Alejandro Colomar (man-pages) (alx.manpages@gmail.com) ---
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@ritter-vogt.de>
    Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

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.

      parent reply	other threads:[~2021-11-23 11:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 10:24 [Bug 215097] New: Example in getpwnam_r man page compares size_t variable to -1 bugzilla-daemon
2021-11-22 12:21 ` [Bug 215097] " bugzilla-daemon
2021-11-22 13:22 ` bugzilla-daemon
2021-11-23 11:46 ` bugzilla-daemon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-215097-11311-uVLQZArsvJ@https.bugzilla.kernel.org/ \
    --to=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-man@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox