mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 16:21:06 +00:00
Remove check for NULL buffer passed to `ptsname_r'
`ptsname_r' is declared in stdlib.h to only accept a `nonnull' second argument and therefore GCC may choose to make optimizations based on the assumption that this argument is NULL. This means that potentially, GCC can optimize away the NULL check at some point in the future. Since this is a programming interface, we might as well remove the NULL check ourselves. This also warrants a change to the `ptsname_r' manual page that must be submitted to the corresponding mailing list. In addition, remove the NULL buffer test in login/tst-ptsname.c.
This commit is contained in:
parent
fdc543919a
commit
8f0a947cf5
@ -1,3 +1,9 @@
|
||||
2017-06-07 Arjun Shankar <arjun.is@lostca.se>
|
||||
|
||||
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_internal):
|
||||
Remove check for NULL 'buf'.
|
||||
* login/tst-ptsname.c (do_test): Remove test with NULL 'buf'.
|
||||
|
||||
2017-06-07 Arjun Shankar <arjun.is@lostca.se>
|
||||
|
||||
* sysdeps/unix/sysv/linux/tst-clone2.c: Do not
|
||||
|
@ -70,7 +70,6 @@ do_test (void)
|
||||
if (fd != -1)
|
||||
{
|
||||
result |= do_single_test (fd, buf, sizeof (buf), 0);
|
||||
result |= do_single_test (fd, NULL, sizeof (buf), EINVAL);
|
||||
result |= do_single_test (fd, buf, 1, ERANGE);
|
||||
close (fd);
|
||||
}
|
||||
|
@ -72,12 +72,6 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
|
||||
int save_errno = errno;
|
||||
unsigned int ptyno;
|
||||
|
||||
if (buf == NULL)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (!__isatty (fd))
|
||||
{
|
||||
__set_errno (ENOTTY);
|
||||
|
Loading…
Reference in New Issue
Block a user