summaryrefslogtreecommitdiff
path: root/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2018-03-20 14:09:46 +0100
committerAndreas Grapentin <andreas@grapentin.org>2018-03-20 14:10:47 +0100
commitb9afff56b2651322de7ea23792fb9daef478c219 (patch)
treeec8837d813b0bcb848ff7b1b8768acb63cf6fa73 /pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
parent4727766b35ea63837841da6dccaa0a4ae5ad634e (diff)
downloadabslibre-b9afff56b2651322de7ea23792fb9daef478c219.tar.gz
abslibre-b9afff56b2651322de7ea23792fb9daef478c219.tar.bz2
abslibre-b9afff56b2651322de7ea23792fb9daef478c219.zip
pcr/qemu-user-static-git: updated to v2.11.0.r2577.gc26ef39204
Diffstat (limited to 'pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch')
-rw-r--r--pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch b/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
new file mode 100644
index 000000000..f2b915b67
--- /dev/null
+++ b/pcr/qemu-user-static-git/0001-fix-program-invocation-name.patch
@@ -0,0 +1,75 @@
+diff --git a/linux-user/main.c b/linux-user/main.c
+index 108e1f202c..30cbb73496 100644
+--- a/linux-user/main.c
++++ b/linux-user/main.c
+@@ -4450,7 +4450,7 @@ static void usage(int exitcode)
+ exit(exitcode);
+ }
+
+-static int parse_args(int argc, char **argv)
++static int parse_args(int argc, char **argv, int assume_P_flag)
+ {
+ const char *r;
+ int optind;
+@@ -4467,6 +4467,19 @@ static int parse_args(int argc, char **argv)
+ }
+ }
+
++ if (assume_P_flag) {
++ /* Assume started by binmisc and binfmt P flag is set */
++ if (argc < 3) {
++ fprintf(stderr, "%s: Please use me through binfmt with P flag\n",
++ argv[0]);
++ exit(1);
++ }
++ filename = argv[1];
++ exec_path = argv[1];
++ /* Next argv must be argv0 for the app */
++ return 2;
++ }
++
+ optind = 1;
+ for (;;) {
+ if (optind >= argc) {
+@@ -4565,7 +4578,8 @@ int main(int argc, char **argv, char **envp)
+
+ qemu_add_opts(&qemu_trace_opts);
+
+- optind = parse_args(argc, argv);
++ execfd = qemu_getauxval(AT_EXECFD);
++ optind = parse_args(argc, argv, execfd > 0);
+
+ if (!trace_init_backends()) {
+ exit(1);
+@@ -4585,7 +4599,6 @@ int main(int argc, char **argv, char **envp)
+
+ init_qemu_uname_release();
+
+- execfd = qemu_getauxval(AT_EXECFD);
+ if (execfd == 0) {
+ execfd = open(filename, O_RDONLY);
+ if (execfd < 0) {
+diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
+index f39ad344fc..d070c33a74 100755
+--- a/scripts/qemu-binfmt-conf.sh
++++ b/scripts/qemu-binfmt-conf.sh
+@@ -292,7 +292,7 @@ SYSTEMDDIR="/etc/binfmt.d"
+ DEBIANDIR="/usr/share/binfmts"
+
+ QEMU_PATH=/usr/local/bin
+-FLAGS=""
++FLAGS="P"
+
+ options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@")
+ eval set -- "$options"
+@@ -341,9 +341,7 @@ while true ; do
+ -c|--credential)
+ shift
+ if [ "$1" = "yes" ] ; then
+- FLAGS="OC"
+- else
+- FLAGS=""
++ FLAGS+="OC"
+ fi
+ ;;
+ *)