Skip to content

由于 _statisticsFile 处理错误导致使用 status 命令时 coredump #4

Description

@zither

默认状态下 _statisticsFile 路径为 /tmp 加上当前启动文件路径,但是下面代码将启动文件路径开头的 / 修改成了 _,导致状态文件内容写到了 / 目录下:

// src/worker.c line 715
_statisticsFile = wmString_dup("/tmp", 4);
wmString_append(_statisticsFile, _startFile);
for (int i = 4; i < _statisticsFile->length; i++) {     // eg: /tmp/www/worker.php -> /tmp_www_worker.php
	if (_statisticsFile->str[i] == '/') {
		_statisticsFile->str[i] = '_';
	}
}

修改替换字符的起始值后可以正常运行。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions