From ff9bea25b5fb3034103dfe6f973255a3bf1f6bce Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 29 Jan 2015 22:11:50 -0500 Subject: fix another unrestrict bug *sigh* --- ios-bootstrap/unrestrict.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ios-bootstrap/unrestrict.c b/ios-bootstrap/unrestrict.c index d8d14dd..11988b1 100644 --- a/ios-bootstrap/unrestrict.c +++ b/ios-bootstrap/unrestrict.c @@ -70,11 +70,12 @@ int main(int argc, char **argv) { * TODO cleanup */ char buf[PROC_PIDFDVNODEINFO_SIZE]; - int ret = proc_pidfdinfo(pid, 255, PROC_PIDFDVNODEINFO, - buf, sizeof(buf)); - if (ret == -1 && errno == EBADF) { + /* A bug in proc_pidfdinfo makes it never return -1. Yuck. */ + errno = 0; + proc_pidfdinfo(pid, 255, PROC_PIDFDVNODEINFO, buf, sizeof(buf)); + if (errno == EBADF) { break; - } else if (ret == -1) { + } else if (errno) { ib_log("proc_pidfdinfo: %s", strerror(errno)); goto fail; } -- cgit v1.2.3