Sponsored Content
Top Forums Programming Segmentation fault in other systems C program Post 302695889 by jlliagre on Tuesday 4th of September 2012 03:40:16 AM
Old 09-04-2012
Quote:
Originally Posted by Zykl0n-B
simple lines like:
Code:
strcpy(sockaddr.sa_data, argv[1]);

Are causing the segmentation violation.
sockaddr might be null or has been overwritten and is pointing to some odd location.
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

hi all i'm trying to execute a c program under linux RH and it gives me segmentation fault, this program was running under unix at&t anybody kow what the problem could be? thanx in advance regards (2 Replies)
Discussion started by: omran
2 Replies

2. AIX

Segmentation fault

I am tring to install Lotus Domino/Notes 5.0.5 on a AIX 4.3.3 server. I go to run the cdrom/ibmpow/install and I get the following error. Lotus Notes for Unix Install Program --------------------------------------------- ./install: 10088 Segmentation fault This had Lotus Notes installed... (1 Reply)
Discussion started by: jshaulis
1 Replies

3. Programming

segmentation fault

sometimes for this code i get a segmentation fault for codes llike this : int main{ int * a= 0; int b; a = (int*)malloc(sizeof(int)); ///some code using these variable but no freeing of a if(a){ free(a); a = 0; } return... (3 Replies)
Discussion started by: wojtyla
3 Replies

4. Programming

Program received signal SIGSEGV, Segmentation fault.

Dear all, I used debugger from C++ and these are the message I got: Program received signal SIGSEGV, Segmentation fault. 0x00323fc0 in free () from /lib/tls/libc.so.6 (gdb) info s #0 0x00323fc0 in free () from /lib/tls/libc.so.6 #1 0x00794fa1 in operator delete () from... (5 Replies)
Discussion started by: napapanbkk
5 Replies

5. UNIX for Dummies Questions & Answers

Segmentation Fault

Hi, While comparing primary key data of two tables thr bteq script I am getting this Error. This script is a shell script. *** Error: The following error was encountered on the output file. Script.sh: 3043492 Segmentation fault(coredump) Please let me know how to get through it. ... (5 Replies)
Discussion started by: monika
5 Replies

6. Programming

segmentation fault

Hi, I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Discussion started by: mind@work
3 Replies

7. Programming

getting Segmentation Fault (core dumped) error but Program runs fine.

i am executing following program int main() { char str; FILE * fp; int i=0; ... (4 Replies)
Discussion started by: bhavesh.sapra
4 Replies

8. UNIX for Advanced & Expert Users

segmentation fault with ps

What does this mean and why is this happening? $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps aux | grep ocular Segmentation fault (core dumped) $ ps Segmentation fault (core dumped) $ pkill okular $ ps... (1 Reply)
Discussion started by: cokedude
1 Replies

9. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
string(3)						     Library Functions Manual							 string(3)

NAME
strcat, strcmp, strcpy, strdup - Perform operations on strings LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <string.h> char *strcat( char *s1, const char *s2); int strcmp( const char *s1, const char *s2); char *strcpy( char *s1, const char *s2); char *strdup( const char *s1); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: strcat(), strcmp(), strcpy(): XSH4.2 strdup(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
In strcat(), specifies the destination string for appending; in strcmp(), specifies the first of two strings to compare; in strcpy(), spec- ifies the destination string for the copying; and in strdup(), specifies the string to be duplicated. In strcat(), specifies the string to be appended to s1; in strcmp(), specifies the second of two strings to compare; and in strcpy(), specifies the source string for the copy- ing. Note [Tru64 UNIX] If you pass a NULL pointer as one of the const char * or char * parameters of a string manipulation function, the function generates a segmentation violation. To avoid the segmentation violation and cause the function to return zero, change the NULL pointer treatment for the process before issuing the call to the string manipulation function, as follows: Include the system header file sys/uswitch.h. Call the uswitch function, as described in the uswitch(2) reference page. The following program illustrates this procedure: #include <stdio.h> #include <sys/types.h> #include <sys/uswitch.h> main() { size_t retval; int uswitch_val; uswitch_val = uswitch(USC_GET,0); uswitch(USC_SET, uswitch_val | USW_NULLP); retval = strdup(NULL); DESCRIPTION
The strcat() function appends a copy of the string pointed to by the s2 parameter (including the terminating null byte) to the end of the string pointed to by the s1 parameter. The initial byte of s2 overwrites the null byte at the end of the string pointed to by s1. When operating on overlapping strings, the behavior of this function is unreliable. The strcmp() function compares the string pointed to by the s1 parameter to the string pointed to by the s2 parameter. The sign of a nonzero value returned by strcmp() is determined by the sign of the difference between the values of the first pair of bytes (both inter- preted as unsigned char) that differ in the two compared objects. The strcmp() function compares strings based on the machine collating order. It does not use the locale-dependent sorting order. Use the strcoll() or wcscoll() functions for locale-dependent sorting. The strcpy() function copies the string pointed to by the s2 parameter (including the terminating null byte) to the location pointed to by the s1 parameter. When operating on overlapping strings, the behavior of this function is unreliable. The strdup() function returns a pointer to a new string that is an exact duplicate of the string pointed to by the s1 parameter. The mal- loc() function is used to allocate space for the new string. RETURN VALUES
On successful completion, the strcat(), strcpy(), and strdup() functions return a pointer to the resulting string. Otherwise, these func- tions return a null pointer. The strdup() function sets errno to indicate the error. On successful completion, the strcmp() function returns an integer whose value is greater than, equal to, or less than 0 (zero), according to whether the s1 string is greater than, equal to, or less than the s2 string. ERRORS
If the strdup() function fails, errno may be set to the following value: Insufficient storage space is available. RELATED INFORMATION
Functions: malloc(3), memccpy(3), setlocale(3), strchr(3), strcoll(3), strlen(3), strncasecmp(3), strncat(3), strncmp(3), strncpy(3), strp- brk(3), strspn(3), strtok(3), strstr(3), strxfrm(3), swab(3), uswitch(2), wcscat(3), wcscmp(3), wcscpy(3) Standards: standards(5) delim off string(3)
All times are GMT -4. The time now is 05:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy