Skip to content

Commit

Permalink
Merge branch 'master' of github.com:minecraft-linux/libc-shim
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX committed Sep 4, 2020
2 parents b1514ae + 3237f2d commit 54a1173
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,15 @@ namespace shim {
socklen_t len = sizeof(sockaddr_storage);

sockaddr_in(const bionic::sockaddr *addr, socklen_t) {
bionic::to_host(addr, ptr());
len = bionic::get_host_len(addr);
if (addr) {
bionic::to_host(addr, ptr());
len = bionic::get_host_len(addr);
} else {
len = 0;
}
}

::sockaddr *ptr() { return (::sockaddr *) &haddr; }
::sockaddr *ptr() { return len ? (::sockaddr *) &haddr : nullptr; }
};

struct sockaddr_out {
Expand Down Expand Up @@ -221,4 +225,4 @@ namespace shim {

}

}
}

0 comments on commit 54a1173

Please sign in to comment.