Re: pg crashing - Mailing list pgsql-general

From Tom Lane
Subject Re: pg crashing
Date
Msg-id 11759.1215011878@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg crashing  (Magnus Hagander <magnus@hagander.net>)
List pgsql-general
BTW, just looking at win32_shmem.c ...

    retptr = malloc(bufsize + 1 + 18);    /* 1 NULL and 18 for
                                           * Global\PostgreSQL: */
    if (retptr == NULL)
        elog(FATAL, "could not allocate memory for shared memory name");

    strcpy(retptr, "Global\\PostgreSQL:");
    r = GetFullPathName(DataDir, bufsize, retptr + 11, NULL);

Surely that "11" ought to be "18".  Also, since the loop immediately
below this is going to convert \ to /, wouldn't it be clearer to
describe the path prefix as Global/PostgreSQL: in the first place?

(BTW, as far as I can tell the +1 added to the malloc request is
useless: bufsize includes the trailing null, and the code would
not work if it did not.)

            regards, tom lane

pgsql-general by date:

Previous
From: Felipe de Jesús Molina Bravo
Date:
Subject: Re: SRF written in C
Next
From: Tom Lane
Date:
Subject: Re: pg_dump - lost synchronization with server: got message type "d", length 6036499