@@ -148,17 +148,13 @@ static void load_modules(enum Architecture arch, struct Context *context) {
148148 context -> len = 0 ;
149149 context -> modules = malloc (1 );
150150
151- // LOGI("Previous error{25}: %s\n", strerror(errno));
152-
153151 DIR * dir = opendir (PATH_MODULES_DIR );
154152 if (dir == NULL ) {
155153 LOGE ("Failed opening modules directory: %s." , PATH_MODULES_DIR );
156154
157155 return ;
158156 }
159157
160- // LOGI("Previous error{27}: %s\n", strerror(errno));
161-
162158 char arch_str [32 ];
163159 switch (arch ) {
164160 case ARM32 : {
@@ -184,11 +180,9 @@ static void load_modules(enum Architecture arch, struct Context *context) {
184180 }
185181
186182 LOGI ("Loading modules for architecture: %s\n" , arch_str );
187- // LOGI("Previous error{28}: %s\n", strerror(errno));
188183
189184 struct dirent * entry ;
190185 while ((entry = readdir (dir )) != NULL ) {
191- // LOGI("Previous error{29}: %s\n", strerror(errno));
192186 if (entry -> d_type != DT_DIR ) continue ; /* INFO: Only directories */
193187 if (strcmp (entry -> d_name , "." ) == 0 || strcmp (entry -> d_name , ".." ) == 0 || strcmp (entry -> d_name , "zygisksu" ) == 0 ) continue ;
194188
@@ -244,8 +238,6 @@ static int create_daemon_socket(void) {
244238}
245239
246240static int spawn_companion (char * name , int lib_fd ) {
247- // LOGI("Previous error{15}: %s\n", strerror(errno));
248-
249241 int sockets [2 ];
250242 if (socketpair (AF_UNIX , SOCK_STREAM , 0 , sockets ) == -1 ) {
251243 LOGE ("Failed creating socket pair.\n" );
@@ -259,8 +251,6 @@ static int spawn_companion(char *name, int lib_fd) {
259251 LOGI ("Companion fd: %d\n" , companion_fd );
260252 LOGI ("Daemon fd: %d\n" , daemon_fd );
261253
262- // LOGI("Previous error{13}: %s\n", strerror(errno));
263-
264254 pid_t pid = fork ();
265255 LOGI ("Forked: %d\n" , pid );
266256 if (pid < 0 ) {
@@ -271,20 +261,16 @@ static int spawn_companion(char *name, int lib_fd) {
271261
272262 exit (1 );
273263 } else if (pid > 0 ) {
274- // LOGI("Previous error{11}: %s\n", strerror(errno));
275-
276264 close (companion_fd );
277265
278266 LOGI ("Waiting for companion to start (%d)\n" , pid );
279- // LOGI("Previous error{8}: %s\n", strerror(errno));
280267
281- int status ;
282- waitpid (pid , & status , 0 );
268+ int status = 0 ;
269+ // waitpid(pid, &status, 0);
283270
284271 LOGI ("Companion exited with status %d\n" , status );
285- // LOGI("Previous error{9}: %s\n", strerror(errno));
286272
287- if (WIFEXITED (status ) && WEXITSTATUS (status ) == 0 ) {
273+ // if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
288274 if (write_string (daemon_fd , name ) == -1 ) return -1 ;
289275
290276 if (send_fd (daemon_fd , lib_fd ) == -1 ) return -1 ;
@@ -302,13 +288,13 @@ static int spawn_companion(char *name, int lib_fd) {
302288 if (response == 0 ) return -2 ;
303289 else if (response == 1 ) return daemon_fd ;
304290 else return -2 ;
305- } else {
306- LOGE ("Exited with status %d\n" , status );
291+ // } else {
292+ // LOGE("Exited with status %d\n", status);
307293
308- close (daemon_fd );
294+ // close(daemon_fd);
309295
310- return -1 ;
311- }
296+ // return -1;
297+ // }
312298 /* INFO: if pid == 0: */
313299 } else {
314300 LOGI ("Companion started (%d)\n" , pid );
@@ -320,7 +306,6 @@ static int spawn_companion(char *name, int lib_fd) {
320306 snprintf (companion_fd_str , 32 , "%d" , companion_fd );
321307
322308 LOGI ("Executing companion...\n" );
323- // LOGI("Previous error{10}: %s\n", strerror(errno));
324309
325310 char * argv [] = { ZYGISKD_FILE , "companion" , companion_fd_str , NULL };
326311 if (execv (ZYGISKD_PATH , argv ) == -1 ) {
@@ -344,20 +329,14 @@ struct __attribute__((__packed__)) MsgHead {
344329void zygiskd_start (void ) {
345330 LOGI ("Welcome to ReZygisk %s!" , ZKSU_VERSION );
346331
347- // LOGI("Previous error{26}: %s\n", strerror(errno));
348-
349332 enum Architecture arch = get_arch ();
350333
351- // LOGI("Previous error{25}: %s\n", strerror(errno));
352-
353334 struct Context context ;
354335 load_modules (arch , & context );
355336
356337 struct MsgHead * msg = NULL ;
357338 size_t msg_sz = 0 ;
358339
359- // LOGI("Previous error{24}: %s\n", strerror(errno));
360-
361340 switch (get_impl ()) {
362341 case None : {
363342 /* INFO: Stop, compiler. */
@@ -425,14 +404,10 @@ void zygiskd_start(void) {
425404 }
426405 }
427406
428- // LOGI("Previous error{22}: %s\n", strerror(errno));
429-
430407 unix_datagram_sendto (CONTROLLER_SOCKET , (void * )msg , msg_sz );
431408
432409 free (msg );
433410
434- // LOGI("Previous error{21}: %s\n", strerror(errno));
435-
436411 int socket_fd = create_daemon_socket ();
437412 if (socket_fd == -1 ) {
438413 LOGE ("Failed creating daemon socket\n" );
@@ -441,7 +416,6 @@ void zygiskd_start(void) {
441416 }
442417
443418 while (1 ) {
444- // LOGI("Previous error{20}: %s\n", strerror(errno));
445419 int client_fd = accept (socket_fd , NULL , NULL );
446420 if (client_fd == -1 ) {
447421 LOGE ("accept: %s\n" , strerror (errno ));
@@ -451,8 +425,6 @@ void zygiskd_start(void) {
451425
452426 LOGI ("Accepted client: %d\n" , client_fd );
453427
454- // LOGI("Previous error{19}: %s\n", strerror(errno));
455-
456428 unsigned char buf [1 ];
457429 ssize_t len = read (client_fd , buf , sizeof (buf ));
458430 if (len == -1 ) {
@@ -627,15 +599,11 @@ void zygiskd_start(void) {
627599 }
628600 case RequestCompanionSocket : {
629601 LOGI ("Requesting companion socket\n" );
630-
631- // LOGI("Previous error{17}: %s\n", strerror(errno));
632602
633603 size_t index_buf [1 ];
634604 ssize_t ret = read (client_fd , & index_buf , sizeof (index_buf ));
635605 ASSURE_SIZE_READ_BREAK ("RequestCompanionSocket" , "index" , ret , sizeof (index_buf ));
636606
637- // LOGI("Previous error{16}: %s\n", strerror(errno));
638-
639607 size_t index = index_buf [0 ];
640608
641609 struct Module * module = & context .modules [index ];
0 commit comments