Free files on dir open failure in COPY.
authorBruce Momjian <[email protected]>
Sun, 24 Feb 2002 02:32:26 +0000 (02:32 +0000)
committerBruce Momjian <[email protected]>
Sun, 24 Feb 2002 02:32:26 +0000 (02:32 +0000)
src/backend/commands/copy.c

index cc57224a2707e4a5756f82a8390e6a435bdc24e2..80ba842a77675f993fb353633eccdd6532b0dc09 100644 (file)
@@ -337,7 +337,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
       
       fstat(fileno(fp),&st);
       if( S_ISDIR(st.st_mode) ){
-        fclose(fp);
+               FreeFile(fp);
         elog(ERROR,"COPY: %s is a directory.",filename);
       }
                }
@@ -389,7 +389,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
                                         (int) geteuid(), filename, strerror(errno), errno);
       fstat(fileno(fp),&st);
       if( S_ISDIR(st.st_mode) ){
-        fclose(fp);
+               FreeFile(fp);
         elog(ERROR,"COPY: %s is a directory.",filename);
       }
                }