aboutsummaryrefslogtreecommitdiff
path: root/darwin-bootstrap
diff options
context:
space:
mode:
authorcomex2015-07-18 00:56:33 -0400
committercomex2015-07-18 00:57:01 -0400
commitcc1ccdfdadcc25e14f2760c55791b712e9eb3a54 (patch)
tree76a3cf775e46507cbd889c30e53173647043844b /darwin-bootstrap
parentformatting (diff)
downloadsubstitute-cc1ccdfdadcc25e14f2760c55791b712e9eb3a54.tar.gz
future proofing
Diffstat (limited to 'darwin-bootstrap')
-rw-r--r--darwin-bootstrap/bundle-loader.c1
-rw-r--r--darwin-bootstrap/substituted.m8
2 files changed, 9 insertions, 0 deletions
diff --git a/darwin-bootstrap/bundle-loader.c b/darwin-bootstrap/bundle-loader.c
index 3b29b55..50cae83 100644
--- a/darwin-bootstrap/bundle-loader.c
+++ b/darwin-bootstrap/bundle-loader.c
@@ -267,6 +267,7 @@ static void init() {
xxpc_object_t message = xxpc_dictionary_create(NULL, NULL, 0);
xxpc_dictionary_set_string(message, "type", "hello");
+ xxpc_dictionary_set_int64(message, "proto-version", 1);
xxpc_dictionary_set_string(message, "argv0", argv0);
xxpc_connection_send_message_with_reply(conn, message, NULL,
^(xxpc_object_t reply) {
diff --git a/darwin-bootstrap/substituted.m b/darwin-bootstrap/substituted.m
index 560d1ac..710a268 100644
--- a/darwin-bootstrap/substituted.m
+++ b/darwin-bootstrap/substituted.m
@@ -346,6 +346,14 @@ enum convert_filters_ret {
if (_argv0 != NULL)
goto bad;
+ int64_t version = xxpc_dictionary_get_int64(request, "proto-version");
+ if (version != 1) {
+ /* in the future there will be a proper unloading mechanism, but here's
+ * a bit of future proofing */
+ NSLog(@"request received from wrong version of bundle-loader: %@", request);
+ xxpc_connection_cancel(_connection);
+ }
+
const char *argv0 = xxpc_dictionary_get_string(request, "argv0");
if (!argv0)
goto bad;