mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. --- ./openvt/openvt.c.orig 2003-08-16 16:44:04.000000000 +0300
  2. +++ ./openvt/openvt.c 2003-08-16 16:42:01.000000000 +0300
  3. @@ -100,18 +100,18 @@
  4. }
  5. consfd = getfd();
  6. - if (consfd < 0) {
  7. - fprintf(stderr,
  8. - _("Couldnt get a file descriptor referring to the console\n"));
  9. - return(2);
  10. - }
  11. - if (ioctl(consfd, VT_GETSTATE, &vtstat) < 0) {
  12. + if (consfd >= 0 && ioctl(consfd, VT_GETSTATE, &vtstat) < 0) {
  13. perror("openvt: VT_GETSTATE");
  14. return(4);
  15. }
  16. if (vtno == -1) {
  17. + if (consfd < 0) {
  18. + fprintf(stderr,
  19. + _("Couldnt get a file descriptor referring to the console\n"));
  20. + return(2);
  21. + }
  22. if ((ioctl(consfd, VT_OPENQRY, &vtno) < 0) || (vtno == -1)) {
  23. perror("openvt: VT_OPENQRY");
  24. fprintf(stderr, _("openvt: cannot find a free vt\n"));
  25. @@ -267,7 +267,7 @@
  26. if ( do_wait ) {
  27. wait(NULL);
  28. - if (show) { /* Switch back... */
  29. + if (show && consfd >= 0) { /* Switch back... */
  30. if (ioctl(consfd, VT_ACTIVATE, vtstat.v_active)) {
  31. perror("VT_ACTIVATE");
  32. return 8;