FreeBSD Bugzilla – Attachment 236309 Details for
Bug 266171
Writing to stdout after moving file descriptor 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
minimum reproducer
move_stdout.c (text/plain), 397 bytes, created by
JunT
on 2022-09-02 10:49:53 UTC
(
hide
)
Description:
minimum reproducer
Filename:
MIME Type:
Creator:
JunT
Created:
2022-09-02 10:49:53 UTC
Size:
397 bytes
patch
obsolete
>#include <stdio.h> >#include <unistd.h> > >int main(void) >{ > /* move fd=1 to 10 */ > if(dup2(1, 10) != 10) > perror("dup2(1,10)"); > close(1); > /* write to stdout(closed) */ > printf("foo\n"); > if(fflush(stdout) != 0) > perror("fflush"); /* we will get EBADF */ > /* move back fd=10 to 1 */ > if(dup2(10, 1) != 1) > perror("dup2(10,1)"); > close(10); > /* write to stdout */ > printf("end\n"); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 266171
: 236309