Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor: update libslirp #160

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vendor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eux -o pipefail
# Aug 26, 2019
LIBSLIRP_COMMIT=d203c81bc6c861e1671122c3194c21d1a6763641
# Nov 21, 2019
LIBSLIRP_COMMIT=d171af3732a0610a25334b06b77fa547bd677918
LIBSLIRP_REPO=https://gitlab.freedesktop.org/slirp/libslirp.git

# Jul 12, 2019
Expand Down
2 changes: 1 addition & 1 deletion vendor/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# DO NOT EDIT MANUALLY

Vendored components:
* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`d203c81bc6c861e1671122c3194c21d1a6763641`)
* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`d171af3732a0610a25334b06b77fa547bd677918`)
* parson: https://github.com/kgabis/parson.git (`c5bb9557fe98367aa8e041c65863909f12ee76b2`)

Please do not edit the contents under this directory manually.
Expand Down
10 changes: 8 additions & 2 deletions vendor/libslirp/src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ g_spawn_async_with_fds_slirp(const gchar *working_directory, gchar **argv,
int fork_exec(struct socket *so, const char *ex)
{
GError *err = NULL;
char **argv;
gint argc = 0;
gchar **argv = NULL;
int opt, sp[2];

DEBUG_CALL("fork_exec");
Expand All @@ -179,7 +180,12 @@ int fork_exec(struct socket *so, const char *ex)
return 0;
}

argv = g_strsplit(ex, " ", -1);
if (!g_shell_parse_argv(ex, &argc, &argv, &err)) {
g_critical("fork_exec invalid command: %s\nerror: %s", ex, err->message);
g_error_free(err);
return 0;
}

g_spawn_async_with_fds(NULL /* cwd */, argv, NULL /* env */,
G_SPAWN_SEARCH_PATH, fork_exec_child_setup,
NULL /* data */, NULL /* child_pid */, sp[1], sp[1],
Expand Down
11 changes: 7 additions & 4 deletions vendor/libslirp/src/sbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ void sbreserve(struct sbuf *sb, int size)
if (sb->sb_data) {
/* Already alloced, realloc if necessary */
if (sb->sb_datalen != size) {
sb->sb_wptr = sb->sb_rptr = sb->sb_data =
(char *)realloc(sb->sb_data, size);
char *new = realloc(sb->sb_data, size);
sb->sb_cc = 0;
if (sb->sb_wptr)
if (new) {
sb->sb_data = sb->sb_wptr = sb->sb_rptr = new;
sb->sb_datalen = size;
else
} else {
free(sb->sb_data);
sb->sb_data = sb->sb_wptr = sb->sb_rptr = NULL;
sb->sb_datalen = 0;
}
}
} else {
sb->sb_wptr = sb->sb_rptr = sb->sb_data = (char *)malloc(size);
Expand Down
4 changes: 3 additions & 1 deletion vendor/libslirp/src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ int soread(struct socket *so)

err = errno;
if (nn == 0) {
if (getpeername(so->s, paddr, &alen) < 0) {
int shutdown_wr = so->so_state & SS_FCANTSENDMORE;

if (!shutdown_wr && getpeername(so->s, paddr, &alen) < 0) {
err = errno;
} else {
getsockopt(so->s, SOL_SOCKET, SO_ERROR, &err, &elen);
Expand Down