pref: 预先分配路径字符串数组,避免过长时动态分配失败

This commit is contained in:
bmy
2024-06-04 12:23:09 +08:00
parent 8897841258
commit 463c6900df

View File

@@ -15,10 +15,8 @@ int main(int argc, char **argv)
FILE *fp;
char errbuf[200];
char *config_path;
config_path = getcwd(NULL, 0);
sprintf(config_path, "%s/%s", config_path, config_file_path);
char config_path[200];
sprintf(config_path, "%s/%s", getcwd(NULL, 0), config_file_path);
log_info("load config from %s", config_path);
fp = fopen(config_path, "r");
if (!fp)