[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r861 - in /fsf/trunk/libc: ./ io/ localedata/ localedata/locales/ nis/ sysdeps/unix/sysv/linux/



Author: eglibc
Date: Wed Dec  6 00:02:05 2006
New Revision: 861

Log:
Import glibc-mainline for 2006-12-06

Added:
    fsf/trunk/libc/io/tst-ttyname_r.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/io/Makefile
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/cs_CZ
    fsf/trunk/libc/nis/nis_subr.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Wed Dec  6 00:02:05 2006
@@ -1,3 +1,17 @@
+2006-12-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nis/nis_subr.c (nis_getnames): Revert last change.
+
+2006-12-04  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/sh/sys/io.h: Removed.

Modified: fsf/trunk/libc/io/Makefile
==============================================================================
--- fsf/trunk/libc/io/Makefile (original)
+++ fsf/trunk/libc/io/Makefile Wed Dec  6 00:02:05 2006
@@ -66,7 +66,7 @@
 		   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
 

Added: fsf/trunk/libc/io/tst-ttyname_r.c
==============================================================================
--- fsf/trunk/libc/io/tst-ttyname_r.c (added)
+++ fsf/trunk/libc/io/tst-ttyname_r.c Wed Dec  6 00:02:05 2006
@@ -1,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;
+}

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Wed Dec  6 00:02:05 2006
@@ -1,3 +1,9 @@
+2006-12-05  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* 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@xxxxxxxxxx>
 
 	* locales/mai_IN: New file.

Modified: fsf/trunk/libc/localedata/locales/cs_CZ
==============================================================================
--- fsf/trunk/libc/localedata/locales/cs_CZ (original)
+++ fsf/trunk/libc/localedata/locales/cs_CZ Wed Dec  6 00:02:05 2006
@@ -2440,9 +2440,9 @@
 
 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_fmt 		"<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
+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><U002D><U0064><U002E><U0025><U002D><U006D><U002E><U0025><U0059>"
 
 t_fmt		"<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>"
 

Modified: fsf/trunk/libc/nis/nis_subr.c
==============================================================================
--- fsf/trunk/libc/nis/nis_subr.c (original)
+++ fsf/trunk/libc/nis/nis_subr.c Wed Dec  6 00:02:05 2006
@@ -178,7 +178,7 @@
     }
 
   /* 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

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname.c Wed Dec  6 00:02:05 2006
@@ -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 @@
   int dostat = 0;
   char *name;
   int save = errno;
-
-  if (__builtin_expect (!__isatty (fd), 0))
-    {
-      __set_errno (ENOTTY);
-      return NULL;
-    }
+  struct termios term;
+
+  /* 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';

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/ttyname_r.c Wed Dec  6 00:02:05 2006
@@ -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 @@
       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';