RE: error:segmentation fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A segmentation fault occurs when your program tries to access memory
locations that haven't been allocated for the program's use. Here are some
common errors that will cause this problem: 
scanf("%d", number); 

In this case, number is integer. scanf() expects you to pass it the address
of the variable you want to read an integer into. But, the writer has
fogotten to use the `&' before number to give scanf the address of the
variable. If the value of number happened to be 3, scanf() would try to
access memory location 3, which is not accessible by normal users. The
correct way to access the address of number would be to place a `&'
(ampersand) before number: 

scanf("%d", &number); 

Another common segmentation fault occurs when you try to access an array
index which is out of range. Let's say you set up an array of integers: 

int integers[80]; 

If, in your program, you try to use an index (the number within the
brackets) over 79, you will ``step out of your memory bounds'', which causes
a segmentation fault. To correct this, rethink your array bounds or the code
that is using the array. 

Satish


-----Original Message-----
From: garima@xxxxxxxxxxxxxx [mailto:garima@xxxxxxxxxxxxxx]
Sent: Tuesday, August 10, 2004 8:59 AM
To: rpm-list@xxxxxxxxxx
Subject: error:segmentation fault


when i try to install my own created rpm(relocatable) it installs very
well on some machines and but gives the following message on one machine:

segmentation fault

i tried to install another rpm(both as root user and non-root user) on
that machine but again the same error was shown.i think something has gone
wrong with that machine or this is a known error.

plz help me out if someone knows the solution or has come across the same
problem.

thanks
garima


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list


_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux