mirror of git://anongit.mindrot.org/openssh.git
Add fallback for old platforms w/out MAP_ANON.
This commit is contained in:
parent
6b9bbbfe8b
commit
15a01cf15f
|
@ -63,6 +63,7 @@ _rs_forkdetect(void)
|
||||||
static inline int
|
static inline int
|
||||||
_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
|
_rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
|
||||||
{
|
{
|
||||||
|
#if defined(MAP_ANON) && defined(MAP_PRIVATE)
|
||||||
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
|
if ((*rsp = mmap(NULL, sizeof(**rsp), PROT_READ|PROT_WRITE,
|
||||||
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
|
MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -73,6 +74,15 @@ _rs_allocate(struct _rs **rsp, struct _rsx **rsxp)
|
||||||
*rsp = NULL;
|
*rsp = NULL;
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ((*rsp = malloc(sizeof(**rsp))) == NULL)
|
||||||
|
return (-1);
|
||||||
|
if ((*rsxp = malloc(sizeof(**rsxp))) == NULL) {
|
||||||
|
free(*rsp);
|
||||||
|
*rsp = NULL;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_ARC4_ATFORK(_rs_forkhandler);
|
_ARC4_ATFORK(_rs_forkhandler);
|
||||||
return (0);
|
return (0);
|
||||||
|
|
Loading…
Reference in New Issue