Find the answer to your Linux question:
Results 1 to 3 of 3
when i use exit(0) ina C program, after exiting i get the segmentation fault error. but if i use _exit(0) it works proper. any ideas why?...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2004
    Location
    Somwhere in India
    Posts
    11

    exit(0)-segmentation fault


    when i use exit(0) ina C program, after exiting i get the segmentation fault error. but if i use _exit(0) it works proper. any ideas why?

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    in what context are you using exit?

  3. #3
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    You've probably corrupted some memory somewhere, which makes an atexit handler installed by libc segfault before it gets to actually terminate the process. I'd suggest running your program through valgrind -- it's a great debugging tool for finding unintional memory corruption.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •