bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: Ben Pfaff <blp@cs.stanford.edu>
Cc: Simon Josefsson <simon@josefsson.org>,
	bug-gnulib@gnu.org, Jim Meyering <jim@meyering.net>
Subject: Re: [PATCH] getpass: Do not check for nonnull prompt argument in Win32 implementation.
Date: Sun, 13 Sep 2020 21:05:32 +0200	[thread overview]
Message-ID: <3236931.FJ2QLDtgkl@omega> (raw)
In-Reply-To: <20200913181047.GA3722105@sigxcpu.benpfaff.org>

Hi Ben,

>   * The POSIX implementation in gnulib passes the prompt to fputs()
>     without checking for null.  I guess we should fix it.

Yes. This bit of added robustness doesn't cost much (neither in terms
of source code and maintenance, nor in terms of generated code).

> From: Ben Pfaff <blp@cs.stanford.edu>
> Date: Sat, 12 Sep 2020 15:54:36 -0700
> Subject: [PATCH] getpass: Check for nonnull prompt argument while avoiding
>  warnings.
> 
> The prompt parameter to getpass() is declared as nonnull (using a GCC
> nonnull attribute).  Gnulib contains two implementations of this function,
> one for POSIX, one for Windows.  The Windows implementation checked for
> a nonnull prompt, which caused a GCC warning.  This commit fixes that by
> avoiding the nonnull attribute when building getpass.c.  The POSIX
> implementation did not check for a nonnull prompt.  This commit increases
> the robustness by adding such a check.
> 
> 2020-09-12  Ben Pfaff  <blp@cs.stanford.edu>
> 
> 	Check for nonnull prompt argument while avoiding warnings.
> 	* lib/getpass.c (_GL_ARG_NONNULL): Define to empty.
> 	(getpass) [!_WIN32]: Print prompt only if nonnull.

Looks good. Applied.

Bruno



  reply	other threads:[~2020-09-13 19:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-12 23:10 [PATCH] getpass: Do not check for nonnull prompt argument in Win32 implementation Ben Pfaff
2020-09-13  8:32 ` Bruno Haible
2020-09-13 18:10   ` Ben Pfaff
2020-09-13 19:05     ` Bruno Haible [this message]
2020-09-13 19:22       ` Ben Pfaff

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=3236931.FJ2QLDtgkl@omega \
    --to=bruno@clisp.org \
    --cc=blp@cs.stanford.edu \
    --cc=bug-gnulib@gnu.org \
    --cc=jim@meyering.net \
    --cc=simon@josefsson.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).