diff --git a/fs/vfs/fs_dupfd2.c b/fs/vfs/fs_dupfd2.c index 3ad7aa0c28..d74ccb44e2 100644 --- a/fs/vfs/fs_dupfd2.c +++ b/fs/vfs/fs_dupfd2.c @@ -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; }