From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | Brent Verner <brent(at)rcfile(dot)org>, Douglas Trainor <trainor(at)uic(dot)edu>, pgsql-bugs(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: COPY when 'filename' is a directory |
Date: | 2002-02-24 01:27:47 |
Message-ID: | 27606.1014514067@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-patches |
Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Brent Verner | 2002-02-24 01:56:22 | Re: COPY when 'filename' is a directory |
Previous Message | Bruce Momjian | 2002-02-23 21:45:45 | Re: COPY when 'filename' is a directory |
From | Date | Subject | |
---|---|---|---|
Next Message | Brent Verner | 2002-02-24 01:56:22 | Re: COPY when 'filename' is a directory |
Previous Message | Bruce Momjian | 2002-02-23 21:49:00 | Re: Cygwin plperl patch |