This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use an alias to `ptsname_r' in login/tst-ptsname.c


On Wed, May 24, 2017 at 07:42:37PM +0200, Florian Weimer wrote:
> I think passing NULL to a nonnull parameter is undefined, warning or
> not.  The GCC documentation is pretty clear about that.  (I have some
> doubts about the validity of the NULL comparison inside the
> implementation of ptsname_r, too.)
> 
> Alternatively, we could withdraw the test as invalid, and update the
> manual page.

Removing the sub-test that tests for EINVAL on NULL sounds like a good
idea to me as well. About the man-page I just looked at
`pthread_create' for comparison:

* the `pthread_t *' argument is declared `nonnull' in pthread.h
* there is no code in `pthread_create' to check if the argument is NULL
* nothing in the man page to indicate what happens when NULL is passed
* compiling `pthread_create (NULL, NULL, NULL, NULL)' without
`-Wall -Werror' produces a binary that SIGSEGVs
* compiling with `-Wall -Werror' errors out the compilation

Given this, maybe in the case of `ptsname_r' it is enough to just drop
the specific test that tests with NULL, and leave the man-page
unchanged? While we are at it, we could also drop the test for NULL in
`ptsname_r'. How does that sound for a PATCH v2?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]