Broken pipe at PQconnectdb

Поиск
Список
Период
Сортировка
Искать

Broken pipe at PQconnectdb

От:
Ross Murray <rmurray@rgsc1.rgsc.nrcan.gc.ca>
Дата:
I thought I was having a C problem, but it appears only to be happening around 
PQconnectdb. (In truth, execution stops so there may be other problems I haven't 
got to yet.) I have, amongst much code:

   void main(int argc, char *argv[]){
	. . . 
	char	*conxinfo . . .
	PGconn	*conx1 . . .
	. . .
	sprintf(conxinfo,"host=%s user=%s dbname=%s",argv[1],argv[2],argv[3]);
	. . .
	fprintf(stderr,"here ");
	conx1 = PQconnectdb(conxinfo);
	fprintf(stderr,"not here ");
	. . .
	
When run I get:

  here Segmentation Fault (core dumped)
  
The dump is: Broken pipe

Any clues?

Re: Broken pipe at PQconnectdb

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Ross Murray  writes:
> 	char	*conxinfo . . .
> 	. . .
> 	sprintf(conxinfo,"host=%s user=%s dbname=%s",argv[1],argv[2],argv[3]);
> 	. . .

Are you malloc'ing adequate space for the conxinfo string?

			regards, tom lane
FAQ