| От | Phil Thompson |
|---|---|
| Тема | Re: [HACKERS] Snapshot 270198 compile error |
| Дата | |
| Msg-id | 34CE3497.1643B8BF@river-bank.demon.co.uk обсуждение |
| Ответ на | Re: [HACKERS] Snapshot 270198 compile error (Bruce Momjian <maillist@candle.pha.pa.us>) |
| Список | 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
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера