Skip to content
Snippets Groups Projects
Commit 5a8a9c42 authored by Guy Zana's avatar Guy Zana
Browse files

dup3(): put an assert and comment in case newfd is already opened.

The old code didn't really close newfd properly, put an assert
and a comment instead for now.
parent 9676b267
No related branches found
No related tags found
No related merge requests found
......@@ -808,21 +808,16 @@ int dup3(int oldfd, int newfd, int flags)
if (error)
goto out_errno;
/* FIXME: Should atomically close newfd or report error */
error = fget(newfd, &org);
/* ignore the error, newfd might not have an open file */
assert(error == 0);
error = fdset(newfd, fp);
if (error) {
fdrop(fp);
if (org)
fdrop(org);
goto out_errno;
}
/* Close previous file if it's opened. */
if (org)
fdrop(org);
fdrop(fp);
return newfd;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment