this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Start a new init process if the old one is a zombie

+13 -1
+13 -1
src/dyld/darling.c
··· 1 1 /* 2 2 This file is part of Darling. 3 3 4 - Copyright (C) 2016 Lubos Dolezel 4 + Copyright (C) 2016-2017 Lubos Dolezel 5 5 6 6 Darling is free software: you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by ··· 141 141 return 0; 142 142 } 143 143 144 + start_init: 144 145 // If prefix's init is not running, start it up 145 146 if (pidInit == 0) 146 147 { ··· 201 202 pidChild = spawnChild(pidInit, MLDR_PATH, 202 203 (const char *[3]) {MLDR_PATH, "/bin/bash", NULL}); 203 204 } 205 + if (pidChild == -ENOMEM) 206 + { 207 + pidInit = 0; 208 + goto start_init; 209 + } 204 210 205 211 // Drop the privileges so that we can be killed, etc by the user 206 212 seteuid(g_originalUid); ··· 248 254 pidChild = fork(); 249 255 if (pidChild < 0) 250 256 { 257 + if (errno == ENOMEM) 258 + { 259 + // This condition happens specifically when the init process is a zombie. 260 + // We should simply start a new init process. 261 + return -ENOMEM; 262 + } 251 263 fprintf(stderr, "Cannot spawn a child process: %s\n", strerror(errno)); 252 264 exit(1); 253 265 }