- if((pw = getpwuid(getuid())) == NULL) {
- bb_error_msg_and_die("Unknown uid %d", getuid());
- }
-
- vfd = xopen(CURRENT_TTY, O_RDWR);
-
- if (ioctl(vfd, VT_GETMODE, &vtm) < 0) {
- bb_perror_msg_and_die("VT_GETMODE");
- }
+ /* Avoid using statics - use constant fd */
+ xmove_fd(xopen(CURRENT_TTY, O_RDWR), vfd);
+ xioctl(vfd, VT_GETMODE, &vtm);