subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1369601 - /subversion/trunk/subversion/svn/file-merge.c
Date Sun, 05 Aug 2012 14:20:15 GMT
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;



Mime
View raw message