Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some issues about the function main_ctx_init #549

Open
huye opened this issue May 18, 2024 · 3 comments
Open

Some issues about the function main_ctx_init #549

huye opened this issue May 18, 2024 · 3 comments

Comments

@huye
Copy link

huye commented May 18, 2024

  1. The length of the macro MAX_PATH is only 260, isn't it really too small?
  2. The logdir directly reads the running directory, then creates and uses the directory logs in this directory. Even if the directory was modified later, an empty directory has already been created here.
  3. The configuration file directory should have a rollback: first try the current directory (not the current directory/etc), then try the directory /usr/local/etc if it does not exist, and finally try the directory /etc.

The main issue is that the directory will be automatically created before customizing the path.

@huye
Copy link
Author

huye commented May 18, 2024

There is another issue, in lines 87 to 90 of the file base/main. c, the following log file path don't use the variable logdir

@House-Men
Copy link

你这问题和我之前遇到的有些类似,我当时提的issue
可惜作者说 可以在main_ctx_init后自行再重新设置conf/pid/log等路径(不过我确实没看出怎么在不调整main_ctx_init逻辑的情况仅更改自定义目录) [并且属于定制化改造需求只能自己维护fork。最终我的fork版改造如下

@House-Men
Copy link

There is another issue, in lines 87 to 90 of the file base/main. c, the following log file path don't use the variable logdir

你说的应该是这个logdir,目的就只是为了尝试创建个目录,只不过后面又用snprintf和logdir同样的方式+文件名保存到g_main_ctx.logfile,也并非没有用到logdir

char logdir[MAX_PATH] = {0};
snprintf(logdir, sizeof(logdir), "%s/logs", g_main_ctx.run_dir);
hv_mkdir(logdir);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants