Segmentation Fault

From: "Frankie Lam" <frankie(at)ucr(dot)com(dot)hk>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Segmentation Fault
Date: 2003-04-03 06:40:45
Message-ID: b6gku9$2llu$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Hi,

I want to ask what does the error message mean by
"0x40023abb in resetPQExpBuffer () from /usr/local/pgsql/lib/libpq.so.3"?
I got this message using GDB to trace the program.
(Segmentation fault occurswhen run the program directly.)

I reviewed the program many times, and found this is only to happen when
I call the `ctime()' or `time()' in a program function.

code fragment FYI
--8<------------------------
// `res = PQexec(conn, sql)' here..
...
...
}
else if (!strcmp(PQfname(res, i), SYNCTIME_FIELD_NAME))
{
// puts("7");
//char chP[30];
printf("timer=%ld\n", time(timer)); // <====== without this line, the
program works
// printf("%s", ctime(time(NULL)));
// printf("%s", asctime(localtime(&timer)));
sprintf(tmp, "'1999-12-11 09:50:58'::timestamp, ");
strcat(p2, tmp);
}
else if (!strcmp(PQfname(res, i), SERVERID_FIELD_NAME))
{
puts("8");
sprintf(tmp, "'%s'", PQgetvalue(res, 0, i));
strcat(p2, tmp);
}
}
...
...
freeing resources here
---------->8--------------

Thank you very much.

Frankie Lam.

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Christoph Haller 2003-04-03 09:11:45 Re: Segmentation Fault
Previous Message Bruce Badger 2003-04-03 00:06:00 FE/BE - Side effects