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

[commits] r6680 - in /fsf/trunk/libc: ChangeLog nscd/connections.c



Author: eglibc
Date: Mon Aug  4 00:04:50 2008
New Revision: 6680

Log:
Import glibc-mainline for 2008-08-04

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/nscd/connections.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Aug  4 00:04:50 2008
@@ -1,3 +1,10 @@
+2008-08-03  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/connections.c (main_loop_poll): Pass a buffer which is
+	guaranteed to be large enough to read inotify event.  Ignore
+	EAGAIN error.  Better error message.  Add branch predicition.
+	(main_loop_epoll): Likewise.
+
 2008-08-02  Roland McGrath  <roland@xxxxxxxx>
 
 	* sysdeps/mach/i386/machine-lock.h (__spin_unlock, __spin_try_lock):

Modified: fsf/trunk/libc/nscd/connections.c
==============================================================================
--- fsf/trunk/libc/nscd/connections.c (original)
+++ fsf/trunk/libc/nscd/connections.c Mon Aug  4 00:04:50 2008
@@ -1868,8 +1868,11 @@
 		  bool to_clear[lastdb] = { false, };
 		  union
 		  {
+# ifndef PATH_MAX
+#  define PATH_MAX 1024
+# endif
 		    struct inotify_event i;
-		    char buf[100];
+		    char buf[sizeof (struct inotify_event) + PATH_MAX];
 		  } inev;
 
 		  while (1)
@@ -1878,17 +1881,20 @@
 							     sizeof (inev)));
 		      if (nb < (ssize_t) sizeof (struct inotify_event))
 			{
-			  if (nb == -1)
+			  if (__builtin_expect (nb == -1 && errno != EAGAIN,
+						0))
 			    {
 			      /* Something went wrong when reading the inotify
 				 data.  Better disable inotify.  */
+			      dbg_log (_("\
+disabled inotify after read error %d"),
+				       errno);
 			      conns[1].fd = -1;
 			      firstfree = 1;
 			      if (nused == 2)
 				nused = 1;
 			      close (inotify_fd);
 			      inotify_fd = -1;
-			      dbg_log (_("disabled inotify after read error"));
 			    }
 			  break;
 			}
@@ -2047,7 +2053,7 @@
 	    union
 	    {
 	      struct inotify_event i;
-	      char buf[100];
+	      char buf[sizeof (struct inotify_event) + PATH_MAX];
 	    } inev;
 
 	    while (1)
@@ -2056,15 +2062,16 @@
 				 		 sizeof (inev)));
 		if (nb < (ssize_t) sizeof (struct inotify_event))
 		  {
-		    if (nb == -1)
+		    if (__builtin_expect (nb == -1 && errno != EAGAIN, 0))
 		      {
 			/* Something went wrong when reading the inotify
 			   data.  Better disable inotify.  */
+			dbg_log (_("disabled inotify after read error %d"),
+				 errno);
 			(void) epoll_ctl (efd, EPOLL_CTL_DEL, inotify_fd,
 					  NULL);
 			close (inotify_fd);
 			inotify_fd = -1;
-			dbg_log (_("disabled inotify after read error"));
 		      }
 		    break;
 		  }