Hi, sorry my english. Recently i was using postgresql 7.2, and then i update to 7.3.3. We was running a C program that was working fine with 7.2, but in 7.3.3 it seg fault.
 
int procesarConsultasSQL(int nCliente){
    .......... more code
    FD_SET(cli->socketDB, &readfds);
    timeout.tv_sec = timeout.tv_usec = 0;
    select(cli->socketDB + 1, &readfds, NULL, NULL, &timeout);
    if (FD_ISSET(cli->socketDB, &readfds)){
        if (PQconsumeInput(cli->conn)){
            if (!PQisBusy(cli->conn)){
                while ((cli->res = PQgetResult(cli->conn)) != NULL){
                    //procesamos los datos devueltos por la base de datos, ya sean
                    //select's o update's y lo agregamos en la cola de envio del cliente
                    switch(PQresultStatus(cli->res)){
                        ....... more code
                    }
                    ....... more code
                    PQclear(cli->res);
                }
                ........ more code
            }
        }
    }
    ....... more code
}
When the program is running for a while, it finish with segmentation fault (core dumped).
 
#0  0x420742e2 in _int_malloc () from /lib/tls/libc.so.6
#1  0x4207360b in malloc () from /lib/tls/libc.so.6
#2  0x400278b3 in PQmakeEmptyPGresult () from /usr/lib/libpq.so.3
#3  0x40028387 in PQconsumeInput () from /usr/lib/libpq.so.3
#4  0x400282f1 in PQconsumeInput () from /usr/lib/libpq.so.3
#5  0x4002886a in PQisBusy () from /usr/lib/libpq.so.3
#6  0x0804c3dc in procesarConsultasSQL(int) ()
#7  0x0804cfe0 in main ()
Is this a know bug?, or the way i am programming this isn't correct? Any help is aprecciated, and thanks to Tom Lane for my other problem, it was solved.
 
Regards,
Tavella Gaston.

Reply via email to