open, fopen: close fd leak in last patch
[pspp] / lib / open.c
index 317fb8afac217dd229d62bb67a7973bcdb6f13f8..97c30cee8c60ed5aa20bea42b64587caedb80d4f 100644 (file)
@@ -115,6 +115,7 @@ open (const char *filename, int flags, ...)
 
          if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode))
            {
+             close (fd);
              errno = ENOTDIR;
              return -1;
            }