2019-05-27 16:34:58 +02:00
|
|
|
diff -uNr qemu-4.0.0/block.c qemu-4.0.0.mod/block.c
|
|
|
|
--- qemu-4.0.0/block.c 2019-04-23 21:14:45.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/block.c 2019-04-30 15:48:40.350266539 +0300
|
|
|
|
@@ -603,20 +603,26 @@
|
|
|
|
int fd;
|
2019-02-21 17:52:24 +01:00
|
|
|
const char *tmpdir;
|
|
|
|
tmpdir = getenv("TMPDIR");
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
if (!tmpdir) {
|
|
|
|
- tmpdir = "/var/tmp";
|
2019-05-27 16:34:58 +02:00
|
|
|
+ tmpdir = "@TERMUX_PREFIX@/tmp";
|
2019-02-21 17:52:24 +01:00
|
|
|
}
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
if (snprintf(filename, size, "%s/vl.XXXXXX", tmpdir) >= size) {
|
|
|
|
return -EOVERFLOW;
|
2019-05-27 16:34:58 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
fd = mkstemp(filename);
|
|
|
|
+
|
|
|
|
if (fd < 0) {
|
|
|
|
return -errno;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
if (close(fd) != 0) {
|
|
|
|
unlink(filename);
|
|
|
|
return -errno;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
diff -uNr qemu-4.0.0/hw/usb/ccid-card-emulated.c qemu-4.0.0.mod/hw/usb/ccid-card-emulated.c
|
|
|
|
--- qemu-4.0.0/hw/usb/ccid-card-emulated.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/hw/usb/ccid-card-emulated.c 2019-04-30 15:50:31.485832837 +0300
|
|
|
|
@@ -415,7 +415,6 @@
|
2019-02-21 17:52:24 +01:00
|
|
|
event_notifier_cleanup(&card->notifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
-#define CERTIFICATES_DEFAULT_DB "/etc/pki/nssdb"
|
|
|
|
#define CERTIFICATES_ARGS_TEMPLATE\
|
|
|
|
"db=\"%s\" use_hw=no soft=(,Virtual Reader,CAC,,%s,%s,%s)"
|
|
|
|
|
2019-05-27 16:34:58 +02:00
|
|
|
@@ -445,13 +444,16 @@
|
|
|
|
VCardEmulOptions *options = NULL;
|
|
|
|
|
|
|
|
snprintf(emul_args, sizeof(emul_args) - 1, CERTIFICATES_ARGS_TEMPLATE,
|
|
|
|
- card->db ? card->db : CERTIFICATES_DEFAULT_DB,
|
|
|
|
+ card->db ? card->db : "@TERMUX_PREFIX@/etc/pki/nssdb",
|
|
|
|
card->cert1, card->cert2, card->cert3);
|
|
|
|
+
|
|
|
|
options = vcard_emul_options(emul_args);
|
|
|
|
+
|
|
|
|
if (options == NULL) {
|
|
|
|
printf("%s: warning: not using certificates due to"
|
|
|
|
" initialization error\n", __func__);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return wrap_vcard_emul_init(options);
|
|
|
|
}
|
|
|
|
|
|
|
|
diff -uNr qemu-4.0.0/include/net/net.h qemu-4.0.0.mod/include/net/net.h
|
|
|
|
--- qemu-4.0.0/include/net/net.h 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/include/net/net.h 2019-04-30 15:47:35.503933215 +0300
|
|
|
|
@@ -209,8 +209,6 @@
|
2019-02-21 17:52:24 +01:00
|
|
|
int net_hub_id_for_client(NetClientState *nc, int *id);
|
|
|
|
NetClientState *net_hub_port_find(int hub_id);
|
|
|
|
|
|
|
|
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
|
|
|
|
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
|
|
|
|
#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
|
|
|
|
#define DEFAULT_BRIDGE_INTERFACE "br0"
|
|
|
|
|
2019-05-27 16:34:58 +02:00
|
|
|
diff -uNr qemu-4.0.0/linux-user/syscall.c qemu-4.0.0.mod/linux-user/syscall.c
|
|
|
|
--- qemu-4.0.0/linux-user/syscall.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/linux-user/syscall.c 2019-04-30 15:51:37.599167189 +0300
|
|
|
|
@@ -6833,7 +6833,7 @@
|
|
|
|
/* create temporary file to map stat to */
|
|
|
|
tmpdir = getenv("TMPDIR");
|
|
|
|
if (!tmpdir)
|
|
|
|
- tmpdir = "/tmp";
|
|
|
|
+ tmpdir = "@TERMUX_PREFIX@/tmp";
|
|
|
|
snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
|
|
|
|
fd = mkstemp(filename);
|
|
|
|
if (fd < 0) {
|
|
|
|
diff -uNr qemu-4.0.0/migration/exec.c qemu-4.0.0.mod/migration/exec.c
|
|
|
|
--- qemu-4.0.0/migration/exec.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/migration/exec.c 2019-04-30 15:52:19.661379049 +0300
|
2019-02-21 17:52:24 +01:00
|
|
|
@@ -28,7 +28,7 @@
|
|
|
|
void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
|
|
|
|
{
|
|
|
|
QIOChannel *ioc;
|
|
|
|
- const char *argv[] = { "/bin/sh", "-c", command, NULL };
|
|
|
|
+ const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL };
|
|
|
|
|
|
|
|
trace_migration_exec_outgoing(command);
|
|
|
|
ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,
|
|
|
|
@@ -55,7 +55,7 @@
|
|
|
|
void exec_start_incoming_migration(const char *command, Error **errp)
|
|
|
|
{
|
|
|
|
QIOChannel *ioc;
|
|
|
|
- const char *argv[] = { "/bin/sh", "-c", command, NULL };
|
|
|
|
+ const char *argv[] = { "@TERMUX_PREFIX@/bin/sh", "-c", command, NULL };
|
|
|
|
|
|
|
|
trace_migration_exec_incoming(command);
|
|
|
|
ioc = QIO_CHANNEL(qio_channel_command_new_spawn(argv,
|
2019-05-27 16:34:58 +02:00
|
|
|
diff -uNr qemu-4.0.0/net/tap.c qemu-4.0.0.mod/net/tap.c
|
|
|
|
--- qemu-4.0.0/net/tap.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/net/tap.c 2019-04-30 15:54:00.958886851 +0300
|
2019-02-21 17:52:24 +01:00
|
|
|
@@ -526,7 +526,7 @@
|
|
|
|
*parg++ = helper_cmd;
|
|
|
|
*parg++ = NULL;
|
|
|
|
|
|
|
|
- execv("/bin/sh", args);
|
|
|
|
+ execv("@TERMUX_PREFIX@/bin/sh", args);
|
|
|
|
} else {
|
|
|
|
/* assume helper is just the executable path name */
|
|
|
|
|
2019-05-27 16:34:58 +02:00
|
|
|
@@ -903,9 +903,9 @@
|
|
|
|
error_setg(errp, "vhostfds= is invalid if fds= wasn't specified");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
- script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
|
|
|
|
- downscript = tap->has_downscript ? tap->downscript :
|
|
|
|
- DEFAULT_NETWORK_DOWN_SCRIPT;
|
|
|
|
+
|
|
|
|
+ script = tap->has_script ? tap->script : "@TERMUX_PREFIX@/etc/qemu-ifup";
|
|
|
|
+ downscript = tap->has_downscript ? tap->downscript : "@TERMUX_PREFIX@/etc/qemu-ifdown";
|
|
|
|
|
|
|
|
if (tap->has_ifname) {
|
|
|
|
pstrcpy(ifname, sizeof ifname, tap->ifname);
|
|
|
|
@@ -932,6 +932,7 @@
|
|
|
|
i >= 1 ? "no" : script,
|
|
|
|
i >= 1 ? "no" : downscript,
|
|
|
|
vhostfdname, vnet_hdr, fd, &err);
|
|
|
|
+
|
|
|
|
if (err) {
|
|
|
|
error_propagate(errp, err);
|
|
|
|
close(fd);
|
|
|
|
diff -uNr qemu-4.0.0/qemu-nbd.c qemu-4.0.0.mod/qemu-nbd.c
|
|
|
|
--- qemu-4.0.0/qemu-nbd.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/qemu-nbd.c 2019-04-30 15:55:17.646269318 +0300
|
|
|
|
@@ -49,7 +49,6 @@
|
|
|
|
#define HAVE_NBD_DEVICE 0
|
|
|
|
#endif
|
2019-02-21 17:52:24 +01:00
|
|
|
|
|
|
|
-#define SOCKET_PATH "/var/lock/qemu-nbd-%s"
|
|
|
|
#define QEMU_NBD_OPT_CACHE 256
|
|
|
|
#define QEMU_NBD_OPT_AIO 257
|
|
|
|
#define QEMU_NBD_OPT_DISCARD 258
|
2019-05-27 16:34:58 +02:00
|
|
|
@@ -88,7 +87,7 @@
|
|
|
|
" -p, --port=PORT port to listen on (default `%d')\n"
|
|
|
|
" -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n"
|
|
|
|
" -k, --socket=PATH path to the unix socket\n"
|
|
|
|
-" (default '"SOCKET_PATH"')\n"
|
|
|
|
+" (default '@TERMUX_PREFIX@/tmp/qemu-nbd-sock-%s')\n"
|
|
|
|
" -e, --shared=NUM device can be shared by NUM clients (default '1')\n"
|
|
|
|
" -t, --persistent don't exit on the last connection\n"
|
|
|
|
" -v, --verbose display extra debugging information\n"
|
|
|
|
@@ -1050,7 +1049,7 @@
|
|
|
|
|
|
|
|
if (device != NULL && sockpath == NULL) {
|
|
|
|
sockpath = g_malloc(128);
|
|
|
|
- snprintf(sockpath, 128, SOCKET_PATH, basename(device));
|
|
|
|
+ snprintf(sockpath, 128, "@TERMUX_PREFIX@/tmp/qemu-nbd-sock-%s", basename(device));
|
|
|
|
}
|
|
|
|
|
|
|
|
server = qio_net_listener_new();
|
|
|
|
diff -uNr qemu-4.0.0/qemu-options.hx qemu-4.0.0.mod/qemu-options.hx
|
|
|
|
--- qemu-4.0.0/qemu-options.hx 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/qemu-options.hx 2019-04-30 15:47:35.506933231 +0300
|
|
|
|
@@ -2086,8 +2086,8 @@
|
|
|
|
" [,poll-us=n]\n"
|
|
|
|
" configure a host TAP network backend with ID 'str'\n"
|
|
|
|
" connected to a bridge (default=" DEFAULT_BRIDGE_INTERFACE ")\n"
|
|
|
|
- " use network scripts 'file' (default=" DEFAULT_NETWORK_SCRIPT ")\n"
|
|
|
|
- " to configure it and 'dfile' (default=" DEFAULT_NETWORK_DOWN_SCRIPT ")\n"
|
|
|
|
+ " use network scripts 'file' (default=@TERMUX_PREFIX@/etc/qemu-ifup)\n"
|
|
|
|
+ " to configure it and 'dfile' (default=@TERMUX_PREFIX@/etc/qemu-ifdown)\n"
|
|
|
|
" to deconfigure it\n"
|
|
|
|
" use '[down]script=no' to disable script execution\n"
|
|
|
|
" use network helper 'helper' (default=" DEFAULT_BRIDGE_HELPER ") to\n"
|
|
|
|
diff -uNr qemu-4.0.0/slirp/src/slirp.c qemu-4.0.0.mod/slirp/src/slirp.c
|
|
|
|
--- qemu-4.0.0/slirp/src/slirp.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/slirp/src/slirp.c 2019-04-30 15:56:37.710667145 +0300
|
|
|
|
@@ -124,14 +124,20 @@
|
|
|
|
struct stat *cached_stat, unsigned *cached_time)
|
|
|
|
{
|
|
|
|
struct stat old_stat;
|
|
|
|
+
|
|
|
|
if (curtime - *cached_time < TIMEOUT_DEFAULT) {
|
|
|
|
memcpy(pdns_addr, cached_addr, addrlen);
|
2019-02-21 17:52:24 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
old_stat = *cached_stat;
|
|
|
|
- if (stat("/etc/resolv.conf", cached_stat) != 0) {
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
|
|
|
+ int ret = stat("@TERMUX_PREFIX@/etc/resolv.conf", cached_stat);
|
|
|
|
+
|
|
|
|
+ if (ret != 0) {
|
2019-02-21 17:52:24 +01:00
|
|
|
return -1;
|
|
|
|
}
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
if (cached_stat->st_dev == old_stat.st_dev
|
2019-05-27 16:34:58 +02:00
|
|
|
&& cached_stat->st_ino == old_stat.st_ino
|
|
|
|
&& cached_stat->st_size == old_stat.st_size
|
|
|
|
@@ -139,6 +145,7 @@
|
|
|
|
memcpy(pdns_addr, cached_addr, addrlen);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -153,7 +160,8 @@
|
2019-02-21 17:52:24 +01:00
|
|
|
void *tmp_addr = alloca(addrlen);
|
|
|
|
unsigned if_index;
|
|
|
|
|
|
|
|
- f = fopen("/etc/resolv.conf", "r");
|
|
|
|
+ f = fopen("@TERMUX_PREFIX@/etc/resolv.conf", "r");
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
if (!f)
|
|
|
|
return -1;
|
|
|
|
|
2019-05-27 16:34:58 +02:00
|
|
|
diff -uNr qemu-4.0.0/tcg/tcg.c qemu-4.0.0.mod/tcg/tcg.c
|
|
|
|
--- qemu-4.0.0/tcg/tcg.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/tcg/tcg.c 2019-04-30 15:57:46.031820043 +0300
|
|
|
|
@@ -4315,11 +4315,13 @@
|
2019-02-21 17:52:24 +01:00
|
|
|
/* Enable this block to be able to debug the ELF image file creation.
|
|
|
|
One can use readelf, objdump, or other inspection utilities. */
|
|
|
|
{
|
|
|
|
- FILE *f = fopen("/tmp/qemu.jit", "w+b");
|
|
|
|
+ FILE *f = fopen("@TERMUX_PREFIX@/tmp/qemu.jit", "w+b");
|
2019-05-27 16:34:58 +02:00
|
|
|
+
|
2019-02-21 17:52:24 +01:00
|
|
|
if (f) {
|
|
|
|
if (fwrite(img, img_size, 1, f) != img_size) {
|
|
|
|
/* Avoid stupid unused return value warning for fwrite. */
|
2019-05-27 16:34:58 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff -uNr qemu-4.0.0/util/qemu-sockets.c qemu-4.0.0.mod/util/qemu-sockets.c
|
|
|
|
--- qemu-4.0.0/util/qemu-sockets.c 2019-04-23 21:14:46.000000000 +0300
|
|
|
|
+++ qemu-4.0.0.mod/util/qemu-sockets.c 2019-04-30 15:58:34.510637663 +0300
|
2019-02-21 17:52:24 +01:00
|
|
|
@@ -841,7 +841,7 @@
|
|
|
|
path = saddr->path;
|
|
|
|
} else {
|
|
|
|
const char *tmpdir = getenv("TMPDIR");
|
|
|
|
- tmpdir = tmpdir ? tmpdir : "/tmp";
|
|
|
|
+ tmpdir = tmpdir ? tmpdir : "@TERMUX_PREFIX@/tmp";
|
|
|
|
path = pathbuf = g_strdup_printf("%s/qemu-socket-XXXXXX", tmpdir);
|
|
|
|
}
|
|
|
|
|