fs: Ensure fs_dupfd2 always return fd2 in the sucessful path

it's wrong to return file_dup2 directly since file_dup2 never return file handle

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I943537849c75d83b3d646a6a22f035187d9fd521
This commit is contained in:
Xiang Xiao 2021-01-02 21:36:31 +08:00 committed by Abdelatif Guettouche
parent 63bc3efd25
commit 14a3c35917

View File

@ -85,5 +85,11 @@ int fs_dupfd2(int fd1, int fd2)
/* Perform the dup2 operation */
return file_dup2(filep1, filep2);
ret = file_dup2(filep1, filep2);
if (ret < 0)
{
return ret;
}
return fd2;
}