this repo has no description
1
fork

Configure Feed

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

Merge pull request #320 from stek29/mldr-no-argv1

Allow execve with empty argv

authored by

Sergey Bugaev and committed by
GitHub
e7d76cc4 248c1d4a

+13 -7
+13 -7
src/startup/mldr.c
··· 91 91 void** sp; 92 92 int pushCount = 0; 93 93 const char* apple[3]; 94 - char *filename, *p; 95 - 94 + char *filename, *p = NULL; 95 + // sys_execve() passes the original file path appended to the mldr path in argv[0]. 96 + if (argc > 0) 97 + p = strchr(argv[0], '!'); 98 + 96 99 if (argc <= 1) 97 100 { 98 - fprintf(stderr, "mldr is part of Darling. It is not to be executed directly.\n"); 99 - return 1; 101 + if (p == NULL) { 102 + fprintf(stderr, "mldr is part of Darling. It is not to be executed directly.\n"); 103 + return 1; 104 + } 105 + else 106 + { 107 + fprintf(stderr, "mldr: warning: Executing with no argv[0]. Continuing anyway, but this is probably a bug.\n"); 108 + } 100 109 } 101 110 102 - // sys_execve() passes the original file path appended to the mldr path in argv[0]. 103 - 104 - p = strchr(argv[0], '!'); 105 111 if (p != NULL) 106 112 { 107 113 filename = (char*) __builtin_alloca(strlen(argv[0])+1);