FreeBSD Bugzilla – Attachment 206224 Details for
Bug 239604
FIONREAD ioctl returns the wrong result on a master pty after the slave has been closed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Example to reproduce the bug
pty-fionread.c (text/plain), 583 bytes, created by
martin
on 2019-08-02 15:51:17 UTC
(
hide
)
Description:
Example to reproduce the bug
Filename:
MIME Type:
Creator:
martin
Created:
2019-08-02 15:51:17 UTC
Size:
583 bytes
patch
obsolete
>#include <sys/types.h> >#include <sys/ioctl.h> >#include <termios.h> >#include <stdlib.h> >#include <stdio.h> >#include <unistd.h> >#if __FreeBSD__ >#include <libutil.h> >#endif > >int main() >{ > int master, slave; > int bytes; > > if (openpty(&master, &slave, NULL, NULL, NULL) == -1) { > perror("openpty"); > exit(1); > } > if (ioctl(master, FIONREAD, &bytes) == -1) { > perror("FIONREAD 1"); > exit(1); > } > printf("bytes1 = %d\n", bytes); > close(slave); > if (ioctl(master, FIONREAD, &bytes) == -1) { > perror("FIONREAD 2"); > exit(1); > } > printf("bytes2 = %d\n", bytes); >}
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 239604
: 206224