libc: handle positive fd on "always-failing" creates (brk and dup)
This commit is contained in:
parent
042e206d13
commit
e2b5953d99
@ -30,6 +30,11 @@ dup(int oldfd, int newfd)
|
||||
f = create("#d/new", -1, in.aslong);
|
||||
if(f == -1)
|
||||
return -1;
|
||||
if(f >= 0){
|
||||
/* this should never happen */
|
||||
close(f);
|
||||
return -1;
|
||||
}
|
||||
out.aslong = ~f;
|
||||
return out.fd[1];
|
||||
}
|
||||
|
@ -18,7 +18,18 @@ enum
|
||||
Round = 7
|
||||
};
|
||||
|
||||
#define brk_(p) ((uintptr_t)~create("#0/brk/set", -1, p))
|
||||
uintptr_t
|
||||
brk_(uintptr_t p)
|
||||
{
|
||||
long f;
|
||||
f = create("#0/brk/set", -1, p);
|
||||
if(f >= 0){
|
||||
/* this should never happen */
|
||||
close(f);
|
||||
return -1;
|
||||
}
|
||||
return (uintptr_t)~f;
|
||||
}
|
||||
|
||||
int
|
||||
brk(void *p)
|
||||
|
Loading…
x
Reference in New Issue
Block a user