You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/08/05 16:20:15 UTC

svn commit: r1369601 - /subversion/trunk/subversion/svn/file-merge.c

Author: stsp
Date: Sun Aug  5 14:20:14 2012
New Revision: 1369601

URL: http://svn.apache.org/viewvc?rev=1369601&view=rev
Log:
* subversion/svn/file-merge.c
  (get_term_width): Plug a file descriptor leak: Close the file descriptor
   used for the TIOCGWINSZ ioctl() call.

Modified:
    subversion/trunk/subversion/svn/file-merge.c

Modified: subversion/trunk/subversion/svn/file-merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/file-merge.c?rev=1369601&r1=1369600&r2=1369601&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/file-merge.c (original)
+++ subversion/trunk/subversion/svn/file-merge.c Sun Aug  5 14:20:14 2012
@@ -43,6 +43,10 @@
 #include <sys/ioctl.h>
 #endif
 
+#if APR_HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 #include <fcntl.h>
 #include <stdlib.h>
 
@@ -309,8 +313,11 @@ get_term_width(void)
   if (fd != -1)
     {
       struct winsize ws;
+      int error;
 
-      if (ioctl(fd, TIOCGWINSZ, &ws) != -1)
+      error = ioctl(fd, TIOCGWINSZ, &ws);
+      close(fd);
+      if (error != -1)
         {
           if (ws.ws_col < 80)
             return 80;