Bruce Momjian <pgman@candle.pha.pa.us> writes:
> {
> + struct stat st;
> fp = AllocateFile(filename, PG_BINARY_R);
> !
> ! if (fp == NULL)
> elog(ERROR, "COPY command, running in backend with "
> "effective uid %d, could not open file '%s' for "
> "reading. Errno = %s (%d).",
> (int) geteuid(), filename, strerror(errno), errno);
> +
> + fstat(fileno(fp),&st);
> + if( S_ISDIR(st.st_mode) ){
> + fclose(fp);
> + elog(ERROR,"COPY: %s is a directory.",filename);
> + }
This coding is WRONG. You do not use fclose() to release a file
opened with AllocateFile.
[ several other instances of same error in patch... ]
regards, tom lane