home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / linux / 8444 < prev    next >
Encoding:
Text File  |  1992-08-17  |  2.3 KB  |  87 lines

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!news.ysu.edu!psuvm!frmop11!dearn!dmswwu1a!pegelow
  2. Organisation: Westfaelische Wilhelms-Universitaet, Muenster, Germany
  3. Date: Monday, 17 Aug 1992 13:53:29 MES
  4. From: Ulrich Pegelow <PEGELOW@DMSWWU1A.UNI-MUENSTER.DE>
  5. Message-ID: <92230.135329PEGELOW@DMSWWU1A.UNI-MUENSTER.DE>
  6. Newsgroups: comp.os.linux
  7. Subject: Re: Ctrl-Alt-Del in linux, doesn't work.
  8. References: <1992Aug4.225341.9785@unibi.uni-bielefeld.de>
  9.  <92226.132926PEGELOW@DMSWWU1A.UNI-MUENSTER.DE>
  10.  <1992Aug13.164743.7685@funet.fi>
  11. Lines: 74
  12.  
  13. In article <1992Aug13.164743.7685@funet.fi> sjm86289@tut.fi
  14. writes:
  15.  
  16. >Yup, right.  I've encountered just the same problem with X11.
  17. >The cure is simple:  as root say  echo > /etc/utmp; reboot
  18. >
  19. >You will not see the warning message, though.  :)
  20.  
  21. Ok, here is another solution. I enclose a patch to shutdown.c
  22. as of admutils-1.1. I'm using the alarm timer to interrupt
  23. the blocking fopen() call if it doesn't return within one
  24. second.
  25.  
  26. Hope this helps
  27.  
  28. Ulrich
  29. pegelow@dmswwu1a.uni-muenster.de
  30.  
  31. BTW: There may be a problem as "patch" might reject the following
  32. context diff; I'm working on a VM/CMS system here (uses EBCDIC
  33. instead of ASCII). As there are only few changes it should be
  34. possible to do them by hand though.
  35.  
  36. *** shutdown.c    Sat Aug 15 19:36:18 1992
  37. --- shutdown.c.new    Sat Aug 15 19:36:42 1992
  38. ***************
  39. *** 36,39 ****
  40. --- 36,45 ----
  41.   }
  42.  
  43. + void alarm_handler()
  44. + {
  45. +     signal(SIGALRM, alarm_handler);
  46. + }
  47. +
  48. +
  49.   main(argc, argv)
  50.       int argc;
  51. ***************
  52. *** 135,138 ****
  53. --- 141,145 ----
  54.       
  55.       signal(SIGINT, int_handler);
  56. +     signal(SIGALRM, alarm_handler);
  57.  
  58.       chdir("/");
  59. ***************
  60. *** 196,199 ****
  61. --- 203,207 ----
  62.   {
  63.       FILE *f;
  64. +     int rest;
  65.       int minutes;
  66.       char term[40] = {'/','d','e','v','/',0};
  67. ***************
  68. *** 201,206 ****
  69.       minutes = timeout / 60;
  70.       (void) strcat(term, ut->ut_line);
  71. !         
  72. !     if(f = fopen(term, "w")) {
  73.           fprintf(f, "\007\r\nURGENT: message from the sysadmin:\r\n");
  74.           if(minutes == 0) {
  75. --- 209,218 ----
  76.       minutes = timeout / 60;
  77.       (void) strcat(term, ut->ut_line);
  78. !
  79. !     rest = alarm(1);
  80. !     f = fopen(term, "w");
  81. !     alarm(rest);    
  82. !     
  83. !     if (f)  {
  84.           fprintf(f, "\007\r\nURGENT: message from the sysadmin:\r\n");
  85.           if(minutes == 0) {
  86.  
  87.