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 <b...@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 <b...@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