aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/timer.c
diff options
context:
space:
mode:
authorJim Blandy1993-03-11 07:00:12 +0000
committerJim Blandy1993-03-11 07:00:12 +0000
commitb1839491710924caf83bfdc2533adfc6ab34aacb (patch)
tree09bca3df087b5e3cb1c601b47b27cc742cbb2a0b /lib-src/timer.c
parent5d13f393f9e41852fcdf144ad65ffb3c819a4b1d (diff)
downloademacs-b1839491710924caf83bfdc2533adfc6ab34aacb.tar.gz
emacs-b1839491710924caf83bfdc2533adfc6ab34aacb.zip
* timer.c (main): Set the ownership of the stdin file descriptor
to the current process. Print error messages if either of the fcntl's fails. * timer.c (sigcatch): Declare this to return SIGTYPE (defined in ../src/config.h), not void.
Diffstat (limited to 'lib-src/timer.c')
-rw-r--r--lib-src/timer.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib-src/timer.c b/lib-src/timer.c
index 51642813fe3..84c384c9f22 100644
--- a/lib-src/timer.c
+++ b/lib-src/timer.c
@@ -213,7 +213,7 @@ getevent ()
213 notify (); 213 notify ();
214} 214}
215 215
216void 216SIGTYPE
217sigcatch (sig) 217sigcatch (sig)
218 int sig; 218 int sig;
219/* dispatch on incoming signal, then restore it */ 219/* dispatch on incoming signal, then restore it */
@@ -262,7 +262,18 @@ main (argc, argv)
262 signal (SIGTERM, sigcatch); 262 signal (SIGTERM, sigcatch);
263 263
264#ifndef USG 264#ifndef USG
265 fcntl (0, F_SETFL, FASYNC); 265 if (fcntl (0, F_SETOWN, getpid ()) == -1)
266 {
267 fprintf (stderr, "%s: can't set ownership of stdin\n", pname);
268 fprintf (stderr, "%s\n", sys_errlist[errno]);
269 exit (1);
270 }
271 if (fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | FASYNC) == -1)
272 {
273 fprintf (stderr, "%s: can't request asynchronous I/O on stdin\n", pname);
274 fprintf (stderr, "%s\n", sys_errlist[errno]);
275 exit (1);
276 }
266#endif /* USG */ 277#endif /* USG */
267 278
268 while (1) pause (); 279 while (1) pause ();