Skip to content

Commit f0b8c5a

Browse files
committed
don't strlcpy to the same location
macos hates this one weird trick
1 parent 1b24996 commit f0b8c5a

1 file changed

Lines changed: 33 additions & 22 deletions

File tree

retroarch.c

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2562,52 +2562,63 @@ bool path_set(enum rarch_path_type type, const char *path)
25622562
p_rarch->dir_savestate);
25632563
break;
25642564
case RARCH_PATH_CORE:
2565-
strlcpy(p_rarch->path_libretro, path,
2566-
sizeof(p_rarch->path_libretro));
2565+
if (path != p_rarch->path_libretro)
2566+
strlcpy(p_rarch->path_libretro, path,
2567+
sizeof(p_rarch->path_libretro));
25672568
break;
25682569
case RARCH_PATH_CORE_LAST:
2569-
strlcpy(p_rarch->path_libretro_last, path,
2570-
sizeof(p_rarch->path_libretro_last));
2570+
if (path != p_rarch->path_libretro_last)
2571+
strlcpy(p_rarch->path_libretro_last, path,
2572+
sizeof(p_rarch->path_libretro_last));
25712573
break;
25722574
case RARCH_PATH_DEFAULT_SHADER_PRESET:
2573-
strlcpy(p_rarch->path_default_shader_preset, path,
2574-
sizeof(p_rarch->path_default_shader_preset));
2575+
if (path != p_rarch->path_default_shader_preset)
2576+
strlcpy(p_rarch->path_default_shader_preset, path,
2577+
sizeof(p_rarch->path_default_shader_preset));
25752578
break;
25762579
case RARCH_PATH_CONFIG:
2577-
strlcpy(p_rarch->path_config_file, path,
2578-
sizeof(p_rarch->path_config_file));
2580+
if (path != p_rarch->path_config_file)
2581+
strlcpy(p_rarch->path_config_file, path,
2582+
sizeof(p_rarch->path_config_file));
25792583
break;
25802584
case RARCH_PATH_CONFIG_DEFAULT:
2581-
strlcpy(p_rarch->path_config_default_file, path,
2582-
sizeof(p_rarch->path_config_default_file));
2585+
if (path != p_rarch->path_config_default_file)
2586+
strlcpy(p_rarch->path_config_default_file, path,
2587+
sizeof(p_rarch->path_config_default_file));
25832588
break;
25842589
case RARCH_PATH_CONFIG_APPEND:
2585-
strlcpy(p_rarch->path_config_append_file, path,
2586-
sizeof(p_rarch->path_config_append_file));
2590+
if (path != p_rarch->path_config_append_file)
2591+
strlcpy(p_rarch->path_config_append_file, path,
2592+
sizeof(p_rarch->path_config_append_file));
25872593
break;
25882594
case RARCH_PATH_CONFIG_OVERRIDE:
2589-
strlcpy(p_rarch->path_config_override_file, path,
2590-
sizeof(p_rarch->path_config_override_file));
2595+
if (path != p_rarch->path_config_override_file)
2596+
strlcpy(p_rarch->path_config_override_file, path,
2597+
sizeof(p_rarch->path_config_override_file));
25912598
break;
25922599
case RARCH_PATH_CORE_OPTIONS:
2593-
strlcpy(p_rarch->path_core_options_file, path,
2594-
sizeof(p_rarch->path_core_options_file));
2600+
if (path != p_rarch->path_core_options_file)
2601+
strlcpy(p_rarch->path_core_options_file, path,
2602+
sizeof(p_rarch->path_core_options_file));
25952603
break;
25962604
case RARCH_PATH_CONTENT:
2597-
strlcpy(p_rarch->path_content, path,
2598-
sizeof(p_rarch->path_content));
2605+
if (path != p_rarch->path_content)
2606+
strlcpy(p_rarch->path_content, path,
2607+
sizeof(p_rarch->path_content));
25992608
break;
26002609
case RARCH_PATH_NONE:
26012610
break;
26022611
case RARCH_PATH_BASENAME:
26032612
runloop_st = runloop_state_get_ptr();
2604-
strlcpy(runloop_st->runtime_content_path_basename, path,
2605-
sizeof(runloop_st->runtime_content_path_basename));
2613+
if (path != runloop_st->runtime_content_path_basename)
2614+
strlcpy(runloop_st->runtime_content_path_basename, path,
2615+
sizeof(runloop_st->runtime_content_path_basename));
26062616
break;
26072617
case RARCH_PATH_SUBSYSTEM:
26082618
runloop_st = runloop_state_get_ptr();
2609-
strlcpy(runloop_st->subsystem_path, path,
2610-
sizeof(runloop_st->subsystem_path));
2619+
if (path != runloop_st->subsystem_path)
2620+
strlcpy(runloop_st->subsystem_path, path,
2621+
sizeof(runloop_st->subsystem_path));
26112622
break;
26122623
}
26132624

0 commit comments

Comments
 (0)