mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 01:33:36 +08:00
* nis/nis_subr.c (nis_getnames): Revert last change.
2006-12-04 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/ttyname.c: Include termios.h. (ttyname): Use tcgetattr instead of isatty, don't set errno to ENOTTY. * sysdeps/unix/sysv/linux/ttyname_r.c: Include termios.h. (__ttyname_r): Use tcgetattr instead of isatty, don't set errno to ENOTTY. * io/Makefile: Add rules to build and run tst-ttyname_r test. * io/tst-ttyname_r.c: New test.
This commit is contained in:
parent
30a58e6599
commit
f0d5e1f67b
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2006-12-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* nis/nis_subr.c (nis_getnames): Revert last change.
|
||||
|
||||
2006-12-04 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/ttyname.c: Include termios.h.
|
||||
(ttyname): Use tcgetattr instead of isatty, don't set errno to ENOTTY.
|
||||
* sysdeps/unix/sysv/linux/ttyname_r.c: Include termios.h.
|
||||
(__ttyname_r): Use tcgetattr instead of isatty, don't set errno to
|
||||
ENOTTY.
|
||||
* io/Makefile: Add rules to build and run tst-ttyname_r test.
|
||||
* io/tst-ttyname_r.c: New test.
|
||||
|
||||
2006-12-03 Kaz Kojima <kkojima@rr.iij4u.or.jp>
|
||||
|
||||
* sysdeps/unix/sysv/linux/sh/sys/io.h: Removed.
|
||||
|
@ -66,7 +66,7 @@ tests := test-utime test-stat test-stat2 test-lfs tst-getcwd \
|
||||
tst-openat tst-unlinkat tst-fstatat tst-futimesat \
|
||||
tst-renameat tst-fchownat tst-fchmodat tst-faccessat \
|
||||
tst-symlinkat tst-linkat tst-readlinkat tst-mkdirat \
|
||||
tst-mknodat tst-mkfifoat
|
||||
tst-mknodat tst-mkfifoat tst-ttyname_r
|
||||
|
||||
distribute := ftwtest-sh
|
||||
|
||||
|
42
io/tst-ttyname_r.c
Normal file
42
io/tst-ttyname_r.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void do_prepare (void);
|
||||
#define PREPARE(argc, argv) do_prepare ()
|
||||
static int do_test (void);
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include <test-skeleton.c>
|
||||
|
||||
static int temp_fd;
|
||||
|
||||
static void
|
||||
do_prepare (void)
|
||||
{
|
||||
char *temp_file;
|
||||
temp_fd = create_temp_file ("tst-ttyname_r.", &temp_file);
|
||||
if (temp_fd == -1)
|
||||
error (1, errno, "cannot create temporary file");
|
||||
}
|
||||
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
int ret = 0;
|
||||
char buf[sysconf (_SC_TTY_NAME_MAX) + 1];
|
||||
int res = ttyname_r (-1, buf, sizeof (buf));
|
||||
if (res != EBADF)
|
||||
{
|
||||
printf ("1st ttyname_r returned with res %d\n", res);
|
||||
ret++;
|
||||
}
|
||||
res = ttyname_r (temp_fd, buf, sizeof (buf));
|
||||
if (res != ENOTTY)
|
||||
{
|
||||
printf ("2nd ttyname_r returned with res %d\n", res);
|
||||
ret++;
|
||||
}
|
||||
return ret;
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
2006-12-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* locales/cs_CZ (LC_TIME): Change d_fmt to %e.%m.%Y from %-d.%-m.%Y.
|
||||
Change d_t_fmt to %a %-d. %B %Y, %H:%M:%S %Z from
|
||||
%a %e. %B %Y, %H:%M:%S %Z.
|
||||
|
||||
2006-11-02 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* locales/mai_IN: New file.
|
||||
|
@ -2440,9 +2440,9 @@ abmon "<U006C><U0065><U0064>";/
|
||||
|
||||
week 7;19971201;4
|
||||
|
||||
d_t_fmt "<U0025><U0061><U00A0><U0025><U0065><U002E><U00A0><U0025><U0042><U00A0><U0025><U0059><U002C><U00A0><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U00A0><U0025><U005A>"
|
||||
d_t_fmt "<U0025><U0061><U00A0><U0025><U002D><U0064><U002E><U00A0><U0025><U0042><U00A0><U0025><U0059><U002C><U00A0><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U00A0><U0025><U005A>"
|
||||
|
||||
d_fmt "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
|
||||
d_fmt "<U0025><U002D><U0064><U002E><U0025><U002D><U006D><U002E><U0025><U0059>"
|
||||
|
||||
t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
|
||||
|
||||
|
@ -178,7 +178,7 @@ nis_getnames (const_nis_name name)
|
||||
}
|
||||
|
||||
/* Get the search path, where we have to search "name" */
|
||||
path = __secure_getenv ("NIS_PATH");
|
||||
path = getenv ("NIS_PATH");
|
||||
if (path == NULL)
|
||||
path = strdupa ("$");
|
||||
else
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -118,12 +119,12 @@ ttyname (int fd)
|
||||
int dostat = 0;
|
||||
char *name;
|
||||
int save = errno;
|
||||
struct termios term;
|
||||
|
||||
if (__builtin_expect (!__isatty (fd), 0))
|
||||
{
|
||||
__set_errno (ENOTTY);
|
||||
return NULL;
|
||||
}
|
||||
/* isatty check, tcgetattr is used because it sets the correct
|
||||
errno (EBADF resp. ENOTTY) on error. */
|
||||
if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
|
||||
return NULL;
|
||||
|
||||
/* We try using the /proc filesystem. */
|
||||
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -115,11 +116,11 @@ __ttyname_r (int fd, char *buf, size_t buflen)
|
||||
return ERANGE;
|
||||
}
|
||||
|
||||
if (__builtin_expect (!__isatty (fd), 0))
|
||||
{
|
||||
__set_errno (ENOTTY);
|
||||
return ENOTTY;
|
||||
}
|
||||
/* isatty check, tcgetattr is used because it sets the correct
|
||||
errno (EBADF resp. ENOTTY) on error. */
|
||||
struct termios term;
|
||||
if (__builtin_expect (__tcgetattr (fd, &term) < 0, 0))
|
||||
return errno;
|
||||
|
||||
/* We try using the /proc filesystem. */
|
||||
*_fitoa_word (fd, __stpcpy (procname, "/proc/self/fd/"), 10, 0) = '\0';
|
||||
|
Loading…
Reference in New Issue
Block a user