fix: 修复futime提示错误22的BUG
调用futime时,系统调用接口函数直接使用了file结构体的f_path字段,该字段在退出前被错误地释放了。 避免该问题需要拷贝一份路径 Signed-off-by: Far <yesiyuan2@huawei.com> Change-Id: Ic0f8e608363da3ed15e252a3f91c46e8397c245e
This commit is contained in:
parent
88a0caae24
commit
8e6f3f1bfb
|
@ -118,7 +118,10 @@ static int GetFullpathNull(int fd, const char *path, char **filePath)
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
return -get_errno();
|
return -get_errno();
|
||||||
}
|
}
|
||||||
fullPath = file->f_path;
|
fullPath = strdup(file->f_path);
|
||||||
|
if (fullPath == NULL) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = GetFullpath(fd, path, &fullPath);
|
ret = GetFullpath(fd, path, &fullPath);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Reference in New Issue