Programming :: Vsprintf Causing Segmentation Fault?

Jan 8, 2011

I'm working on some code which suddenly is causing a segmentation on vsprintf. This was working before, so I cut and pasted some code from vsprintf function at the cplusplus site and even this is causing a problem. Anyway the example is

Code:

void PrintFError (const char * format, ...)
{
char buffer[256];
va_list args;

[code]....

View 5 Replies


ADVERTISEMENT

Ubuntu :: Perl Tkx Causing Segmentation Fault?

Dec 29, 2010

Running a clean install of Ubuntu 10.10 under VMWare Player on a Thinkpad with Win7. Have previously used Perl/TK for GUI apps to run under both Windows & Linux. Latest Activestate Perl (Windows) does not support Perl/Tk, recommends Tkx, so I wanted to see if Tkx would work under Ubuntu. Tried to install Tkx using cpan, got obscure failure indicating dependency problem. Found a recommendation to apt-get install tcl8.5-dev, and then cpan installed Tkx.

Note, perl 5.10.1 is installed in Maverick by default. apt-get upgrade says I have the latest perl, Tcl and TK. I installed Tkx version 1.09 (using cpan). Couldn't find any info on what perl / Tkx versions are compatible. Now Tkx is installed, but any attempt to run a script that uses Tkx causes a segmentation fault. apt-get installed pmtools to investigate. Even examining Tkx with pmtools can cause a seg fault, for example:

$ pmvers Tkx
Segmentation fault

Is Tkx known to work (or not work) under Ubuntu,version 10.10 or other versions? Any suggestions about what to try next?It's hard to find info about Perl Tkx because so many people put "Can u help, tkx in advance" or similar in postings about anything under the sun. I've read a lot of them.

View 1 Replies View Related

Ubuntu Servers :: Oci8 Causing Segmentation Fault In PHP?

Apr 1, 2010

I'm having a problem with the oci8 module in PHP. I have been running this server for over a year with this configuration and never had an issue... I had been away since last Thursday, and suddenly this started happening this morning. I'm the only one who has server access, which has me baffled.

I've narrowed it down to the oci8 module because:

* I created a PHP script that does nothing except call oci_login(), which seg faults.
* Any web page that uses the oci functions fails... it asks you to download the PHP file, which is empty (likely because the oci_login call done before anything in PHP is printed).

View 1 Replies View Related

Programming :: What Is The Segmentation Fault

Apr 19, 2011

I using a linux kernel v2.6.26.something. Distribution: OpenSuse 10.3. While writing a c program on linux in KATE, i used character pointers to declare a string like, for ex: " char *temp " but compilation with gcc gives me the error," Segmentation Fault " what is segmentation Fault Why does it occur or what are the reasons behind it?

View 14 Replies View Related

Programming :: Socket And Segmentation Fault

Jul 16, 2010

I am programming an application with an ARM device with an embedded version of Linux. My application talks to a java application via socket. If there is any connection problems, it attempts the connection again. My problem is that after exactly 146 times, there is a Segmentation Fault. Apparently this happens in opening the socket, which is not successful after this amount of attempts.

Following, some code that I'm using:

The function for openning the socket and perform a connection:

Code:

View 2 Replies View Related

Programming :: [C] Segmentation Fault If Optimized?

Feb 15, 2011

I wrote a small c-code, which is based on a pseudorandom-alogrithm from the internet[URL]If i compile the code with "gcc test.c -o test -O2" the output is: "4194449".That's ok.I can compile the code without optimizations and the outut is the same.But if i compile the code with "gcc test.c -o test -O3" it creates a segmentation fault. But why? why this happens?Here the code:

Code:
#include <stdio.h>
// Code based on http://www.dreamincode.net/code/snippet342.htm

[code]....

View 3 Replies View Related

Programming :: How To Create Segmentation Fault?

Jun 16, 2010

simple program to create a segmentation fault:my problem is if i include the same code char *s="hello world"; *s='H'; in my project, it is not giving any seg fault, instead it runs without any problem. what may be the issue.

View 13 Replies View Related

Programming :: Why Red Hat Cannot Log Segmentation Fault In Any Of Log Files

Sep 16, 2010

I would just like to ask why my red hat cannot log a segmentation fault in any of the log files located in / var/ log. I purposely tried executing a C++ program that segfaults but nothing was logged.

View 3 Replies View Related

Programming :: Segmentation Fault Error And GDB

Jul 23, 2010

When I compile my C program on SUSE, I receive a segmentation fault error. To my knowledge, this occurs when a program tries to recall memory but is not allowed to. So I'm using GDB for the first time to solve this problem. After a series of commands, I reach this point:

Code:
#0 0x00002b13e1bab127 in getdelim () from /lib64/libc.so.6
#1 0x000000000040167b in main () at dmsp_cusp.c:158

Here's the offending code in dmsp_cusp.c:
Code:
157 printf("enter the input file name:");
158 getline(in_fname);
159 fp3 = fopen(in_fname, "r");
160 if(fp3 == NULL) {
161 printf("can't open input file %s",in_fname);
162 exit(1); }

View 1 Replies View Related

Programming :: Segmentation Fault During The Memcpy()

Feb 20, 2010

Why is this giving me a segmentation fault ?

Code:

#include<stdio.h>
#include<string.h>
#include<malloc.h>
int main ()

[code]....

View 10 Replies View Related

Programming :: Segmentation Fault While Trying To Run C Program

Jul 28, 2011

i wrote a program to fill an array with 100 random numbers ranging from 1 - 200. i compiled the program using gcc. the program successfully compiled but when i try to run it i get a segmentation fault. here is the code. i put *** on the line that gdb indicated was the problem.

#include <stdio.h>
#include<stdlib.h>
#include<time.h>

[code]....

View 2 Replies View Related

Programming :: STD Sort With G++ - O3 Segmentation Fault

Jan 27, 2010

I have program like this:

Code:

with 'gcc -g' it runs well, but with 'gcc -g -O3' (with -O2 too) it crash.

output is something like this:

Code:

and gdb says

Code:

Why it try to compare something at address 0x209 when this address is not in the vector?

View 1 Replies View Related

Programming :: Getting Segmentation Fault Error?

Jul 1, 2010

I am getting Segmentation fault error .Dont know where it is

Code:
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

[Code]....

Getting Segmentation fault

View 11 Replies View Related

Programming :: What Can Trigger A Segmentation Fault

Jan 15, 2010

I have this basic program that is supposed to scan a string for a delimiter and output which segment of the string the user wants, like awk '{print $2}'. The problem is, I always get a segmentation fault when I run the code and I can't figure out what triggered it.

Here is my code:

Code:

int main(void) {
char *string = "my name is joe";
char dlimit = ' ', *good;
int index = 2, round = 0;
int i, place = 0, t;

[code]....

It keeps track of how many times the delimiter was found with round, and the position of the last found delimiter with place. index is to specify which segment of the string the user wants. One more thing, is it necessary to manually allocate memory with malloc() or calloc() when you can just initialize a variable and it be fine? Like:

Code:

int z = malloc(sizeof(int));
when you can:
int z;

View 12 Replies View Related

Programming :: Server Is Crashing With Segmentation Fault?

May 2, 2011

I am getting below information from the core file on our production servers. one of our server is crashing with segmentation fault .Program terminated with signal 11, Segmentation fault.

#0 0x00b24332 in _int_malloc () from /lib/libc.so.6
(gdb) where
#0 0x00b24332 in _int_malloc () from /lib/libc.so.6

[code]....

View 2 Replies View Related

Programming :: Segmentation Fault After Second Dlopen() Attempt?

Feb 7, 2010

The game is quite old (2002!) and I'm trying to mod the old version of it (1.02a), the jk2ded server linux binary.The game engine loads my mod's .so file which I compiled using:

Code:

gcc -shared -static -g -fPIC g_syscalls.c common.c main.c -o out/jk2mpgamei386.so
So whilst launching the server for the first time, it loads the .so file using dlopen() without problems and the output is:

Code:

Loading dll file jk2mpgame.
Sys_LoadDll(/web/web11/jk2/base/jk2mpgamei386.so)...
Sys_LoadDll(jk2mpgame) found **vmMain** at 0xb2ed9413
Sys_LoadDll(jk2mpgame) succeeded!
[ NT's Fix ] GAME_INIT

and then it works correctly until I try to change the map the server is on currently.When a map changes on the server,the .so file has to be unloaded.After unloading with dlclose() without errors, when the new map is launched the engine tries to reload the .so into the memory with dlopen() but fails:

Code:

map_restart 0
Cvar_Set2: sv_serverid 78710500
==== ShutdownGame ====

[code]....

View 3 Replies View Related

Programming :: Segmentation Fault In Program At Run Time?

Oct 16, 2010

I am making a program to do a breadth first search.The code which I am posting here just makes a que of the nodes visited in a binary tree in inorder fashion,so this implementation is not yet complete.While developing I got a segmentation fault which I was not able to understand why I am getting so I am posting since the tree of same program (without BFS) is working.

Code:
#include<stdio.h>
#include<stdlib.h>

[code]...

View 4 Replies View Related

Programming :: Getting Segmentation Fault Using Shared Memory?

Jan 8, 2011

I'm writing a producer-consumer program, where the producer and the consumer are different processes and they communicate using queued signals, and when I run it it comes out always 'segmentation fault'.

Here is my code:

(note: I tried using both 'shm_open()' and 'mmap()', and 'shmget()' and shmat()')

Code:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

[code]....

View 10 Replies View Related

Programming :: Segmentation Fault While Sending UDP Packets?

Jul 16, 2009

The following piece of code is suppose to send a UDP packet.but inside function udpsocketinit , i get a segmentation fault and i can not understand why

Code:
#include <arpa/inet.h>
#include <netinet/in.h>

[code]...

View 5 Replies View Related

Programming :: Segmentation Fault With Popen And Fgetws?

Dec 12, 2010

Is it ok to read a process output with fgetws? I get segmentation fault when I try that.

Code:
#include <iostream>
#include <cstdio>
int main()
{
wchar_t line[4096];

[Code]...

I can read the output from the process if I use fgets instead of fgetws.But I am getting special characters in the output for some commands, that is why I wanted to try with fgetws.

View 4 Replies View Related

Programming :: Program Giving Segmentation Fault?

Dec 25, 2010

My program is to find the values of variables using matrices and in matrices using GAUSS ELIMINATION method. It gives segmentation fault then I input the values of coefficients of the variables.

#include<stdio.h>
void main()
{
int n;
int i,j,l;
float m;

[Code]...

View 5 Replies View Related

Programming :: Segmentation Fault" Due To The Volumn Of Data?

Jun 18, 2010

I downloaded the C4.5 code from web, and it works fine with me. But when I use it to treat large data, it has error message like "segmentation fault". While, I think it is not due to the volumn of data. Is that a bug? so what is the general problem of "segmentation fault"?

View 2 Replies View Related

Programming :: C - When Write A Program That Gives The Segmentation Fault Error

Jun 9, 2010

I am using Ubuntu 9.04 linux 2.6.28-11-generic. When I write a program that gives the "Segmentation fault" error, or when I send this signal (SIGSEGV) to a program, the "Segmentation fault" is shown and no core dumped. When I look for "core" file in the current directory, I can't find it, too.

View 2 Replies View Related

Programming :: C: Segmentation Fault When Freeing Allocated 2D Array?

Jun 1, 2011

I know that seems to be a common question, but information from the web does not So problem is in the title.

Here is what I do:

First I declare the pointers.
Code:
double **rijx,**rijy,**rijz;
Then I allocate the require memory.

[Code]...

View 2 Replies View Related

Programming :: Can A Segmentation Fault Affect Other Running Programs

Jul 30, 2011

I tried a little C programming, and got a bunch of segmentation fault the first few tries. But from what I understand, the whole purpose of segmentation faults is the protect other programs from the damaging effects of my program. Yet, if I trigger a segfault enough times, weird things happen to my other running programs. I usually run a console inside Kate, and after 10 or so segfaults, Kate sometimes freezes or randomly highlights text, etc. just random behavior. Also, my desktop will occasionally hang and things will start failing, like copying files and such. I have to log out to restore everything to normal, but logging out is difficult since the logout prompt freezes. I have never experienced such behavior before I began programming, my system has been relatively stable. I run my program from inside Kate's console, so I was wondering if all KDE applications share memory or something, because this has happened once or twice, and only when I trigger a segfault many times.

View 4 Replies View Related

Programming :: Input/output Trouble Cause Segmentation Fault?

Jul 13, 2011

Dear advanced c/g++ programers:A program request me to enter twice inputthat program probably is tested good on visual c++ 7.1 on window xp,but my system is g++ on linux(Ubuntu10.04)

It assume
Enter some strings: a b c d
^Z

[code]....

View 1 Replies View Related

Programming :: Weird SIGALRM Segmentation Fault On 64bit?

Apr 17, 2010

I've got a weird segmentation fault on the ending 'retq' instruction of my alarm callback, as if "calling pointer size" mismatched the 'q' of the 64bit retq. I've been trying to understand this bug for a while and couldn't get a clue. This code worked well on 32bit Slackware/Ubuntu/Debian. It now crashes on my 64bit Slackware install. I've written a small test case script for those who want to try it :

Code:
#!/bin/sh
#test-sigalrm-pack.sh
# 64bit sigalrm segmentation fault test case package...
echo " * Generating source..."
cat>tst-sigalrm.cpp<<TESTSRC
//tst-sigalrm.cpp

[Code]...

Paste this script into a file (like "test-sigalrm-pack.sh") and execute it ( $ sh test-sigalrm-pack.sh ), it will generate a cpp file (the source) and another script file that use the kind of link I need (static link) in the current directory. Also in order to link you might want to create a symbolic link to you glibc files (see note in the build script), I don't know how to do that "universally" (without the symbolic link 'hack')

View 14 Replies View Related

Programming :: Attempting To Do A Strdup Is Failing With A Segmentation Fault Within Libc?

Mar 12, 2010

Does anyone see a problem with my code? attempting to do a strdup is failing with a segmentation fault within libcplugintools.h

Code:
/* Provide function for adding files to be copied/linked
into report

[code]...

View 1 Replies View Related

Programming :: Short C++ Program Segmentation Fault. Using GCC 4.4.5 On Ubuntu 32bit?

Jun 12, 2011

I'm very excited to post a question, since I always do everything by myself. I'm reading several lines from a text file using istream::getline(char *, streamsize n). I get the file name from the command line. Here is the code:

Code:
#include <iostream>
#include <fstream>
using namespace std;
int main ( int argc, char *argv[])

[Code]...

Using GCC 4.4.5 on Ubuntu 32bit Btw: I know assembly language and know what a segmentation fault is

View 4 Replies View Related

Programming :: Run Program That Distributes Grades And Puts It In A Table - Keep Getting Segmentation Fault

Apr 19, 2011

I'm trying to run my program that distributes grades and puts it in a table. The code compiles but when I run it I get a Segmentation Fault. I'm still new to arrays, but I think the issue is where I'm trying to make the table. Here is my code:

Code:

#include <stdio.h>
#include "constant.h"
int readValues(int[]);
int findMedian(int[], int);

[code]....

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved