Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 628161 Details for
Bug 859485
G-C-C's « Region & Language » panel causes weird keyboard behavior by calling ioctl(fd, KDSKBMODE, K_UNICODE)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Reproducer
foo.c (text/plain), 2.45 KB, created by
Rui Matos
on 2012-10-16 13:36:09 UTC
(
hide
)
Description:
Reproducer
Filename:
MIME Type:
Creator:
Rui Matos
Created:
2012-10-16 13:36:09 UTC
Size:
2.45 KB
patch
obsolete
>#include <assert.h> >#include <stdio.h> >#include <unistd.h> >#include <stdlib.h> >#include <errno.h> >#include <fcntl.h> >#include <sys/ioctl.h> >#include <linux/kd.h> > >#define USEC_PER_MSEC 1000ULL > >int close_nointr(int fd) { > assert(fd >= 0); > > for (;;) { > int r; > > r = close(fd); > if (r >= 0) > return r; > > if (errno != EINTR) > return -errno; > } >} > >void close_nointr_nofail(int fd) { > int saved_errno = errno; > > /* like close_nointr() but cannot fail, and guarantees errno > * is unchanged */ > > close_nointr(fd) == 0; > > errno = saved_errno; >} > >int open_terminal(const char *name, int mode) { > int fd, r; > unsigned c = 0; > > /* > * If a TTY is in the process of being closed opening it might > * cause EIO. This is horribly awful, but unlikely to be > * changed in the kernel. Hence we work around this problem by > * retrying a couple of times. > * > * https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245 > */ > > for (;;) { > fd = open(name, mode); > if (fd >= 0) > break; > > if (errno != EIO) > return -errno; > > /* Max 1s in total */ > if (c >= 20) > return -errno; > > usleep(50 * USEC_PER_MSEC); > c++; > } > > if (fd < 0) > return -errno; > > r = isatty(fd); > if (r < 0) { > close_nointr_nofail(fd); > return -errno; > } > > if (!r) { > close_nointr_nofail(fd); > return -ENOTTY; > } > > return fd; >} > >int main(int argc, char **argv) { > const char *vc; > int fd = -1; > int r = EXIT_FAILURE; > > if (argv[1]) > vc = argv[1]; > else > vc = "/dev/tty0"; > > fd = open_terminal(vc, O_RDWR|O_CLOEXEC); > if (fd < 0) { > printf("Failed to open %s\n", vc); > goto finish; > } > > if (ioctl(fd, KDSKBMODE, K_UNICODE) < 0) { > printf("Error setting current keyboard mode: %s\n", strerror(errno)); > goto finish; > } > > r = EXIT_SUCCESS; >finish: > if (fd >= 0) > close_nointr_nofail(fd); > > return r; >}
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 859485
:
615495
|
615496
| 628161