Skip to content

Commit 4c1a1a3

Browse files
committed
Ensure that the argument of shmdt(2) is declared "void *".
Our gcc-on-Solaris buildfarm members emit "incompatible pointer type" warnings in places where it's not. This is a bit odd, since AFAICT Solaris follows the POSIX spec in declaring shmdt's argument as "const void *", and you'd think any pointer argument would satisfy that. But whatever. Part of a general push to remove off-the-beaten-track warnings where we can easily do so.
1 parent 1f6e0ce commit 4c1a1a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/port/sysv_shmem.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static void
289289
IpcMemoryDetach(int status, Datum shmaddr)
290290
{
291291
/* Detach System V shared memory block. */
292-
if (shmdt(DatumGetPointer(shmaddr)) < 0)
292+
if (shmdt((void *) DatumGetPointer(shmaddr)) < 0)
293293
elog(LOG, "shmdt(%p) failed: %m", DatumGetPointer(shmaddr));
294294
}
295295

@@ -323,7 +323,7 @@ PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
323323
IpcMemoryState state;
324324

325325
state = PGSharedMemoryAttach((IpcMemoryId) id2, NULL, &memAddress);
326-
if (memAddress && shmdt(memAddress) < 0)
326+
if (memAddress && shmdt((void *) memAddress) < 0)
327327
elog(LOG, "shmdt(%p) failed: %m", memAddress);
328328
switch (state)
329329
{
@@ -807,7 +807,7 @@ PGSharedMemoryCreate(Size size,
807807
break;
808808
}
809809

810-
if (oldhdr && shmdt(oldhdr) < 0)
810+
if (oldhdr && shmdt((void *) oldhdr) < 0)
811811
elog(LOG, "shmdt(%p) failed: %m", oldhdr);
812812
}
813813

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy