On Wed, Jul 08, 2015 at 12:00:35PM +0200, Roberto E. Vargas Caballero wrote:
>
> > We are ignoring return value of dup(), so just remove it.
>
>
> From dup(3):
>
>The dup() system call creates a copy of the file descriptor oldfd,
>using the lowest-numbered unused descriptor
> In fact, the only thing that can be done here is:
>
> close(STDIN_FILENO);
> dup(cmdfd);
> + close(cmdfd);
> stty();
>
> because we are not going to use this file descriptor anymore,
> but I think we will not have a significant improvement.
> We are ignoring return value of dup(), so just remove it.
>From dup(3):
The dup() system call creates a copy of the file descriptor oldfd,
using the lowest-numbered unused descriptor for the new descriptor.
> if((cmdfd = open(opt_line, O_RDWR)) < 0)
>
Connor Lane Smith wrote:
> This code was brought up a few months ago [1]. The return value is
> ignored because, as STDIN_FILENO is 0 and has just been closed, the
> returned new file descriptor must be 0. A number of us think that the
> implicitness here is a mistake, and that dup2 should be used
Hi,
On 8 July 2015 at 11:32, Christian Hesse wrote:
> We are ignoring return value of dup(), so just remove it.
This code was brought up a few months ago [1]. The return value is
ignored because, as STDIN_FILENO is 0 and has just been closed, the
returned new file descriptor must be 0. A number
From: Christian Hesse
We are ignoring return value of dup(), so just remove it.
Signed-off-by: Christian Hesse
---
st.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/st.c b/st.c
index b89d094..406afa8 100644
--- a/st.c
+++ b/st.c
@@ -1321,7 +1321,6 @@ ttynew(void) {
if((cm