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.

83 lines
2.4 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/util-linux/sak_blocking.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
  10. #
  11. # This patch file is dual-licensed. It is available under the license the
  12. # patched project is licensed under, as long as it is an OpenSource license
  13. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  14. # of the GNU General Public License as published by the Free Software
  15. # Foundation; either version 2 of the License, or (at your option) any later
  16. # version.
  17. #
  18. # --- ROCK-COPYRIGHT-NOTE-END ---
  19. --- ./login-utils/agetty.c.orig Sun Mar 4 21:43:50 2001
  20. +++ ./login-utils/agetty.c Wed Mar 21 10:17:47 2001
  21. @@ -231,10 +231,14 @@
  22. int bcode P_((char *s));
  23. void usage P_((void));
  24. void error P_((const char *, ...));
  25. +void sak_blocking P_((int signr));
  26. #undef P_
  27. /* The following is used for understandable diagnostics. */
  28. +/* message file for SAK blocking */
  29. +char *sakmsg="/dev/null";
  30. +
  31. char *progname;
  32. /* Fake hostname for ut_host specified on command line. */
  33. @@ -393,7 +397,7 @@
  34. extern int optind; /* getopt */
  35. int c;
  36. - while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:wn"))) {
  37. + while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:s:wn"))) {
  38. switch (c) {
  39. case 'I':
  40. if (!(op->initstring = malloc(strlen(optarg)))) {
  41. @@ -464,6 +468,10 @@
  42. if ((op->timeout = atoi(optarg)) <= 0)
  43. error(_("bad timeout value: %s"), optarg);
  44. break;
  45. + case 's': /* SAK blocking after time out */
  46. + signal(SIGALRM,sak_blocking);
  47. + sakmsg = optarg;
  48. + break;
  49. case 'w':
  50. op->flags |= F_WAITCRLF;
  51. break;
  52. @@ -1251,4 +1259,26 @@
  53. #endif
  54. (void) sleep((unsigned) 10); /* be kind to init(8) */
  55. exit(1);
  56. +}
  57. +
  58. +/* signal handler for alarm() timeout when doing SAK blocking */
  59. +
  60. +void sak_blocking(int signr) {
  61. + char buf[512];
  62. + int fd,rc,i;
  63. +
  64. + if (signr != SIGALRM) return;
  65. + alarm(0);
  66. +
  67. + /* print the SAK Message */
  68. + fd=open(sakmsg,O_RDONLY);
  69. + if (fd >= 0) {
  70. + while ( (rc=read(fd,buf,512)) > 0 )
  71. + write(1,buf,rc);
  72. + close(fd);
  73. + }
  74. +
  75. + /* lock */
  76. + for (i=1; i<=30; i++) signal(i,SIG_IGN);
  77. + while (1) sleep(600);
  78. }