From 9fc8f74f399568dc23a18ed522808df8f7f24867 Mon Sep 17 00:00:00 2001 From: HOLZSCHUCH Nicolas Date: Thu, 4 Jun 2020 18:46:54 +0200 Subject: [PATCH] Don't create a sh session inside a sh session --- ios_system.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ios_system.m b/ios_system.m index 314e97af..d3c657e9 100644 --- a/ios_system.m +++ b/ios_system.m @@ -951,9 +951,11 @@ int sh_main(int argc, char** argv) { } NSFileManager *fileManager = [[NSFileManager alloc] init]; // NSLog(@"parentSession = %x currentSession = %x currentDir = %s\n", parentSession, currentSession, [fileManager currentDirectoryPath].UTF8String); + if (currentSession->context == sh_session) { + return 1; // We cannot have a sh command starting a sh command. + } if (parentSession == NULL) { - if (currentSession->context != sh_session) - parentSession = currentSession; + parentSession = currentSession; parentDir = [fileManager currentDirectoryPath]; } ios_switchSession(&sh_session); // create a new session