Discord ask-to-join fixes (#7903)

* C89 Fix

* use strlcat instead

* declare i on top

* declare buf on top
This commit is contained in:
Andrés 2019-01-05 19:16:28 -05:00 committed by bparker06
parent bbfbefa9dd
commit 714631b38d
2 changed files with 11 additions and 9 deletions

View File

@ -3351,6 +3351,7 @@ void cb_generic_download(void *task_data,
void *user_data, const char *err)
{
char output_path[PATH_MAX_LENGTH];
char buf[PATH_MAX_LENGTH];
#if defined(HAVE_COMPRESSION) && defined(HAVE_ZLIB)
bool extract = true;
#endif
@ -3363,7 +3364,6 @@ void cb_generic_download(void *task_data,
goto finish;
output_path[0] = '\0';
char buf[PATH_MAX_LENGTH];;
/* we have to determine dir_path at the time of writting or else
* we'd run into races when the user changes the setting during an

View File

@ -640,16 +640,9 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
{
const char *optstring = NULL;
bool explicit_menu = false;
unsigned i;
global_t *global = global_get_ptr();
/* Nasty hack to copy the args into a global so discord can register the same arguments for launch */
char buf[4096];
for (unsigned i = 0; i < argc; i++)
{
snprintf(buf, sizeof(buf), "%s %s", launch_arguments, argv[i]);
strlcpy(launch_arguments, buf, sizeof(launch_arguments));
}
string_trim_whitespace_left(launch_arguments);
const struct option opts[] = {
#ifdef HAVE_DYNAMIC
@ -701,6 +694,15 @@ static void retroarch_parse_input_and_config(int argc, char *argv[])
{ NULL, 0, NULL, 0 }
};
/* Copy the args into a buffer so launch arguments can be reused */
for (i = 0; i < argc; i++)
{
strlcat(launch_arguments, argv[i], sizeof(launch_arguments));
strlcat(launch_arguments, " ", sizeof(launch_arguments));
}
string_trim_whitespace_left(launch_arguments);
/* Handling the core type is finicky. Based on the arguments we pass in,
* we handle it differently.
* Some current cases which track desired behavior and how it is supposed to work: