this repo has no description
1
fork

Configure Feed

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

mldr: Fix special env var processing order

Special environment variables need to be processed prior to the call to
`load_fat`, because mldr_binprefs needs to be read before then.

This fixes the `arch` command.

+8 -3
+8 -3
src/startup/mldr/mldr.c
··· 128 128 strcpy(filename, argv[1]); 129 129 } 130 130 131 + process_special_env(&mldr_load_results); 132 + 131 133 #ifdef __i386__ 132 134 load(filename, CPU_TYPE_X86, false, argv, &mldr_load_results); // accept i386 only 133 135 #else ··· 405 407 406 408 if (str != NULL) { 407 409 sscanf(str, "%x,%x,%x,%x", &lr->bprefs[0], &lr->bprefs[1], &lr->bprefs[2], &lr->bprefs[3]); 408 - unsetenv("__mldr_bprefs"); 409 410 } 410 411 411 412 str = getenv("__mldr_sockpath"); ··· 417 418 } 418 419 strncpy(__dserver_socket_address_data.sun_path, str, sizeof(__dserver_socket_address_data.sun_path) - 1); 419 420 __dserver_socket_address_data.sun_path[sizeof(__dserver_socket_address_data.sun_path) - 1] = '\0'; 420 - unsetenv("__mldr_sockpath"); 421 421 422 422 lr->socket_path = __dserver_socket_address_data.sun_path; 423 423 } ··· 430 430 lr->root_path = root_path; 431 431 lr->root_path_length = strlen(lr->root_path); 432 432 } 433 + }; 434 + 435 + static void unset_special_env() { 436 + unsetenv("__mldr_bprefs"); 437 + unsetenv("__mldr_sockpath"); 433 438 }; 434 439 435 440 static void setup_space(struct load_results* lr, bool is_64_bit) { ··· 459 464 exit(1); 460 465 } 461 466 462 - process_special_env(lr); 467 + unset_special_env(); 463 468 464 469 lr->kernfd = socket(AF_UNIX, SOCK_DGRAM, 0); 465 470 if (lr->kernfd < 0) {