I'm installing PostgresQL 6.1.1 on our DEC Alphaservers in order
to give them access via psql to the database running on a separate
Linux box. I noticed the mailing list queries last month from
people who had problems with PostgresQL under Digital UNIX and ran
across the same problem myself. The symptom is that remote access
to data via pqsl gives the message

FATAL: unrecognized data from the backend. It probably dumped core.
FATAL: unrecognized data from the backend. It probably dumped core.

and other accesses more or less directly via libpq presumably will
fail in the same way. A quick look through the source showed the
usual problem: an assumption that long is 32 bits, surprise, surprise.
Here's a patch which apparently fixes it for me. I don't know if there
are any other such bugs lurking in there but this at least gets things
moving again.

- --Malcolm

- ------------------------------ cut here ------------------------------
- --- backend/libpq/pqcomprim.c.ORI Tue Jul 1 05:00:32 1997
+++ backend/libpq/pqcomprim.c Thu Sep 11 16:09:09 1997
@@ -27,7 +27,7 @@
# if BYTE_ORDER == BIG_ENDIAN
# define ntoh_s(n) (u_short)(((u_char *)&n)[1] << 8 \
((u_char *)&n)[0])
- -# define ntoh_l(n) (u_long) (((u_char *)&n)[3] << 24 \
+# define ntoh_l(n) (uint32) (((u_char *)&n)[3] << 24 \
((u_char *)&n)[2] << 16 \
((u_char *)&n)[1] << 8 \
((u_char *)&n)[0])
@@ -60,10 +60,10 @@
int pqPutLong(int integer, FILE *f)
{
int retval = 0;
- - u_long n;
+ uint32 n;

n = hton_l(integer);
- - if(fwrite(&n, sizeof(u_long), 1, f) != 1)
+ if(fwrite(&n, sizeof(uint32), 1, f) != 1)
retval = EOF;

return retval;
@@ -86,9 +86,9 @@
int pqGetLong(int *result, FILE *f)
{
int retval = 0;
- - u_long n;
+ uint32 n;

- - if(fread(&n, sizeof(u_long), 1, f) != 1)
+ if(fread(&n, sizeof(uint32), 1, f) != 1)
retval = EOF;

*result = ntoh_l(n);
- --- backend/port/inet_aton.c.ORI Wed Mar 19 05:00:37 1997
+++ backend/port/inet_aton.c Thu Sep 11 16:09:09 1997
@@ -57,7 +57,7 @@
int
inet_aton(const char *cp, struct in_addr *addr)
{
- - register u_long val;
+ register uint32 val;
register int base, n;
register char c;
u_int parts[4];
- ------------------------------ cut here ------------------------------

- --
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Unix Systems Programmer
Oxford University Computing Services

- --
Bruce Momjian
maillist@candle.pha.pa.us

------------------------------

End of hackers-digest V1 #481
*****************************

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedSep 11, '97 at 3:18p
activeSep 11, '97 at 3:18p
posts1
users1
websitepostgresql.org...
irc#postgresql

1 user in discussion

Malcolm Beattie: 1 post

People

Translate

site design / logo © 2021 Grokbase