linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Vijayekkumaran.M" <m_vkumaran@yahoo.com>
To: linux-c-programming@vger.kernel.org
Subject: SIGFPE captured repeatedly..
Date: Thu, 2 Sep 2004 04:36:48 -0700 (PDT)	[thread overview]
Message-ID: <20040902113648.10036.qmail@web41108.mail.yahoo.com> (raw)

Hi,

I am trying to write a small program which handles
SIGFPE..
The problem is that the handler is called infinitely..

Could somebody please tell me what I am missing..?
Please find the program below..

"Red Hat Linux release 7.3 (Valhalla)
Kernel 2.4.18-3 on an i686
gcc version 2.96"

Regards
Vijay

/*********************************************/
#include <signal.h>
#include <stdio.h>

void sig_s(int signo)
{
 printf("Hai Division by zero:Floation point
exception\n");
 /*signal(SIGFPE,sig_s);*/
}

#define BUFFER_SIZE 1024

int main()
{
 int i,j,z;
 char Buffer[BUFFER_SIZE];
 int x;
 FILE* fp = fdopen(0,"r");
 signal(SIGFPE,sig_s);
 
 for(x=0;x<5;x++)
 {
  fflush(fp);
  i=0;j=0;
  printf("Accepted i = %d and j= %d \n",i,j);
  z = i/j;
  printf("Result = %d\n",z);
 }
 return 0;
}
/*********************************************/


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

             reply	other threads:[~2004-09-02 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-02 11:36 Vijayekkumaran.M [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-02 11:48 SIGFPE captured repeatedly Ganesh_Borse
2004-09-02 12:24 Colovic (ext_evosoft) Aleksandar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040902113648.10036.qmail@web41108.mail.yahoo.com \
    --to=m_vkumaran@yahoo.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).