mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Incorect signal handling ?
@ 2001-04-12 20:31 Daniel Podlejski
  2001-04-12 21:27 ` Richard B. Johnson
  2001-04-12 21:56 ` Doug McNaught
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Podlejski @ 2001-04-12 20:31 UTC (permalink / raw)
  To: Linux Kernel List

Hi,

there is litlle programm:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>

static void empty(int sig)
{
	printf ("hello\n");
	return;
}

void main()
{
        int fd, a;
        char buf[512];

	if (fd = open("/tmp/nic", O_RDONLY) < 0)
	{
		perror ("open");
		exit(1);
	}

	signal (SIGALRM, empty);
	alarm (1);

        a = read(fd, buf, 511);

        while (a && a != -1) a = read(fd, buf, 511);

	if (a == -1)
	{
		perror ("read");
		exit(1);
	}
	else printf ("EOF\n");

        exit(0);
}

I open /tmp/nic and run compiled program.
There should be error EINTR in read, but isn't.
Why ?

-- 
Daniel Podlejski <underley@underley.eu.org>
   ... Here await the birth of the son
   The seventh, the heavenly, the chosen one ...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-04-12 21:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12 20:31 Incorect signal handling ? Daniel Podlejski
2001-04-12 21:27 ` Richard B. Johnson
2001-04-12 21:56 ` Doug McNaught

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®