Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Snapshot 270198 compile error

From: Phil Thompson <phil(at)river-bank(dot)demon(dot)co(dot)uk>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Goran Thyni <goran(at)bildbasen(dot)se>, fenix(at)am(dot)ring(dot)ru, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Snapshot 270198 compile error
Date: 1998-01-27 19:25:11
Message-ID: 34CE3497.1643B8BF@river-bank.demon.co.uk (view raw or flat)
Thread:
Lists: pgsql-hackers
Bruce Momjian wrote:

>   #define       UNIXSOCK_PATH(sun,port) \
>         (sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
> !               + 1 + sizeof ((sun).sun_family))
> ! /*
> !  *            + 1 is for BSD-specific sizeof((sun).sun_len)
> !  *            We never actually set sun_len, and I can't think of a
> !  *            platform-safe way of doing it, but the code still works. bjm
> !  */

I don't think this is going to work.  On glibc2 you will end up with a
trailing '\0' in the socket name.  You won't be able to see it but I
think it will be there.  Is the following version portable?

#define	UNIXSOCK_PATH(sun,port) \
	(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
	((char *)&(sun).sun_path[0] - (char *)&(sun)))

Phil

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1998-01-27 19:50:01
Subject: Re: [HACKERS] Snapshot 270198 compile error
Previous:From: Bruce MomjianDate: 1998-01-27 18:23:36
Subject: deadlock detection

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group