Programming :: Using Realloc Multiple Times / 4th Iteration In The Loop Realloc Fails In Strarray_add?

Feb 27, 2010

I have a string problem with a function I am writing and I cant figure it out. I am trying to write unit test which will verify it works as expected. As I need to make use of it elsewhere and obviously robust and correct enough that I can rely on it. Okay first of all I define the following structure

Code:
typedef struct strarray {
int size;
char **elements;
} strarray;
code....

My problem is that upon the 4th iteration in the loop realloc fails in strarray_add. glibc reports invalid next size.

View 6 Replies


ADVERTISEMENT

Programming :: Subsequent Calls To Realloc Cause Memory Dump?

Feb 17, 2010

I'm trying to write a C program that extends an array to any user inputed size.

Code:
if (arraysize == 0) {
arraysize = (int) pos + 1;
a = (int *) calloc (arraysize,sizeof(int));
for (i = 0 ; i < arraysize ; i++ )
a[i] = -1;
code....

The program dumps with that sequence of inputs everytime, but might dump an input before or after if different positions are requested. Interestingly, when I tested pos = 2000..2008, I got no dumps. So is realloc somehow trying to extend the array into bad space?

View 2 Replies View Related

Programming :: Realloc(): Invalid Next Size / Getting Error With Reallocate Memory In MakeDSt Function For DSt->SArray?

Jul 19, 2011

I wrote a test program for learning usage of realloc() and I thin I did everything right but I get this error exactly with my 4th time that while tries to reallocate memory in MakeDSt function for DSt->SArray:

Quote:

realloc(): invalid next size

this is my complete code :

Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct DRA
{
code....

View 2 Replies View Related

Programming :: C Realloc Resize Array / Delete And Add Information Into The Array?

Mar 6, 2011

I am trying to dynamically delete and add information into the array "blah"

Code:
int blahsize = 1;
char** blah = (char**) calloc(blahsize+1,sizeof(char*));
Adding information:
Code:
blah[1]=stuff1;
blah[2]=stuff2;
code....

View 2 Replies View Related

Server :: Script Running Ssh Commands (via Loop) Exiting After First Iteration?

Oct 24, 2010

One of my servers needs to issue an "apt-get update" command on each of the clients in a lab. However, after the first update, it exits. In trying to replicate the problem with a simpler script, I created the following which fetches the listings of multiple directories from a client:

NUM=0
cat paths | while read DIR; do
ssh server-name ls $DIR > /tmp/$NUM.txt
NUM=`expr $NUM + 1`
done

Again, after the first iteration, the script exists. I tried the following line too, but it made no difference:

bash -c ssh server-name ls $DIR > /tmp/$NUM.txt

The only thing that worked so far is this

xterm -e ssh server-name ls $DIR > /tmp/$NUM.txt

View 3 Replies View Related

Programming :: For Loop To Iterate Four Times, Print , Then Start Again?

Jul 24, 2011

This is an slice from an other wise successful script. What i need it to do is print one <tr> then print <td>$stat_array</td> fours times, quit print a </tr> then print another <tr> , prints the next four $stat_arrays in @stat_array, and so on and then a </table>.What it does is print all eight $start_arrays then a </tr>

Code:
my @table_header = ("Process", "Region_Permission","Region Violation","Message Type");
my @stat_array =("ibfarm102 - localtick" ," Greenwich" ," hibmis100 - procHKHD2 - Hongkong" , "PidMonRsp" ,"

[code]....

View 1 Replies View Related

Programming :: Application Process Starts Multiple Times?

Jul 15, 2011

I'm porting C++ application from ARM to MIPS platform. It works now, but I see some strange timing problems. I've seen now that My app process is called multiply time. Here is "top" output:

Mem: 24592K used, 102084K free, 0K shrd, 0K buff, 16864K cached
CPU: 0% usr 99% sys 0% nice 0% idle 0% io 0% irq 0% softirq
Load average: 4.02 2.17 0.95
PID PPID USER STAT VSZ %MEM %CPU COMMAND
1888 1875 admin R 12096 10% 98% ./my_app.exe
code....

I don't see something like this when I compile it for x86, nor ARM.On MIPS I use uClibc instead of glibc.

View 6 Replies View Related

Programming :: Make An AWK Script That Goes Over The File Multiple Times?

Mar 11, 2010

Is it possible to make an AWK script that goes over the file multiple times, every time doing something different to it?

View 19 Replies View Related

Programming :: Same Program Runs Multiple Times But Get Very Different Results?

Dec 7, 2010

I used wait4 to time a child process. but the results differ each other dramatically. why?my core source code lists as below.to the point: in linux 2.6 kernel, how to time a process with a high precision. and, only its user-time rather than the elapsed time???

static struct rusage ruse;
static pid_t u_pid;
int main(int argc, char *argv[])
{
int i;
code....

View 14 Replies View Related

Programming :: Perl's Length() Counts Umlauts Multiple Times

Dec 14, 2010

I'm programming some skript to get statistical information about some texts. This includes calculating the mean of word lengths.Unfortunately, Umlauts count as two characters. In the example below the output is 9, it should be 6.

sincercly, Max

Code:
#!/usr/bin/perl
use POSIX;
use locale;
my $test = length("ABC���");
print $test;

View 4 Replies View Related

Programming :: G++ Fails On Multiple Files If There's A Template Involved

Aug 12, 2010

If I remove all the template stuff, it works.

whats going on here?

View 2 Replies View Related

Ubuntu Multimedia :: Loop A Video A Number Of Times In Ffmpeg Or Mencoder?

Jun 5, 2010

How do you loop a video a number of times in ffmpeg or mencoder? I made a ogv out of a gif. It loops 1 time, so it's less than a second.

View 4 Replies View Related

Ubuntu :: Multiple Times To Report A Bug, But Can't?

Sep 2, 2010

I have tried multiple times to report a bug, but can't. All I can find is this USELESS guide: [URL]Is this seriously the ONLY way to report a bug? I can't just fill out a form somewhere without running software to do it? When I try to do it the way explained in the guide, it tells me that I'm using a stable version of Xubuntu, and that only people running dev versions (like 11.10) can report bugs.Are they saying that all stable releases are perfect in every way? Surely one must be able to report a bug for them...?

View 5 Replies View Related

OpenSUSE :: Konqueror Started Again And Again - Multiple Times ?

Mar 14, 2010

I have a strange effect here, where konqueror is started multiple times. It is no problem to start it from the K-Menu. But konqueror seems to be associated with different actions in applications, e.g. many "help" entries; among others e.g. Inkscape: "Hilfe/Inkscape Handbuch" (~ Help/Inkscape handbook") If I'm unfortunate enough to hit such an item, the konqueror items start flooding my task bar, while the mouse cursor - changed to the konqueror icon - is flickering like wild, while konqueror is starting again and again. None of the windows really open and all icons disappear after some time. (due to some resource overflow, but unfortunately I can't find the relevant log entry this time) How can I prevent this ? (Or debug this, if the cause is unclear)

View 7 Replies View Related

Ubuntu :: 10.04 Freezes Or Crashes Multiple Times?

Oct 12, 2010

[Staff Note: This thread was spun off from here: HOWTO: Purge and Reinstall Grub 2 from the Live CD This solved the Grub problem but the crashes continue.]

Just as I get up and running again my 10.04 (64 bit) either freezes up totally, closes all windows that are open, fails to restart or shut down forcing a restart.

There's no pattern to it, i might be using the gimp or checking thunderbird emails, possibly just surfing or running bluefish. Nothing major and I'm not one to go delving under the bonnet so to speak and start tweaking things. I have the AWN dock installed and run a dual monitor setup.

Everytime it's crashed, the damn thing doesn't reboot, I get the init =bootarg message I've been reading a lot about and once again I have to run the liveCD and spend several minutes farting about purging and reinstalling grub.

I despise Windows, overall I am enjoying my ubuntu experience but things like this stop me getting any work done.

My PC ran fine for the last 2 days then suddenly it's playing up again. It's not an old machine, quad core processor, plenty of RAM.

I am having to back stuff up as soon as I do it due to so many crashes per day. I have reinstalled the OS and started again from scratch 4 times now in the last month.

The last thing I want to do is go back to Windoze but I am seriously running out of patience with ubuntu.

Boot Info Script Results:

Code:
# Boot Info Script 0.55 dated February 15th, 2010

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in
partition #1 for /boot/grub.
code....

View 7 Replies View Related

Ubuntu :: 11.04 Not Booting - Need To Restart Multiple Times

Jun 26, 2011

I have Ubuntu 11.04 on a disk, and installed it on an empty hard drive. When I start my desktop my screen is black with a flashing "_" in the top left corner... Nothing happens. I usually have to restart the computer multiple times before it will actually work. I tried running Ubuntu in recovery mode and fixing any broken packages, but no luck.

View 1 Replies View Related

General :: Rotate Logfiles Multiple Times A Day

Mar 13, 2011

how can I rotate logfiles multiple times a day? I notice that the configuration for the logrotate-command is hourly, daily, weekly,.I notice that I can create a cron job where I specify the different times the log rotation need to be done:15 0,8,12,17 * * *But how do I combine these two ?

View 7 Replies View Related

CentOS 5 :: Server Has Crashed On My Multiple Times?

Jul 12, 2010

My 5.5 server has crashed on my multiple times over the past few weeks. I have 2 terabyte drives mirrored.It automatically reboots and seems to run fine after rebooting.I've attached a copy of the /var/log/message to this post.I was unable to paste file.I'm not if a bad disk is causing the problem or not.

View 4 Replies View Related

Networking :: NFS Mount Fails - Times Out - NFS Server Is In DMZ - NFS Client Is In Intranet

May 14, 2010

Both server (web01), in DMZ, and client (app01), intranet, are Linux OEL5.5.

A few hints follows:

1- I ssh to web01, in DMZ, from a intranet machine on my desktop, export my DISPLAY, and try to bring up xclock; nothing happens.

2- traceroute from web01 to app01 fails.

3- NFS mount from web01, nfs server, to nfs client, app01, fails.

How should my network configuration on web01 or app01 be to make this NFS mount from web01 to app01 work?Each server has 4 NICs, I've only used eth0.

View 2 Replies View Related

OpenSUSE :: Reinstall Multiple Times From Standart Playground And Kde KDE?

Oct 3, 2010

I have experienced amarok crash after which i am not able to bring it back to working state. I tried to reinstall it multiple times from standart playground and kde KDE:UpdatedApps repositories. Every time. i start amarok it hangs on splash screen consuming 49% of CPU with no signs to load completely. I guess i need to clean reinstall with deleting all tracing info form previous install?

here's output from console:

Code:
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
101003 11:21:54 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite

[Code]...

View 6 Replies View Related

Ubuntu :: Reinstalled Grub2 Multiple Times Before, But On /dev/sda1, Now It Is Not?

Oct 15, 2010

I've reinstalled Grub2 multiple times before, but Ubuntu was on /dev/sda1, now it is not. Here is my partition table:

/dev/sda1 - 105GB - Windows
/dev/sda2 - 200GB - Extended
/dev/sda5 - 110GB - Media

[code]....

View 4 Replies View Related

Ubuntu :: Udev Triggers Add-rule Multiple Times?

May 2, 2011

On Ubuntu 10.04 I would like to setup udev to execute a backup script when a specific USB drive is inserted. Udev detects the USB drive, but my script is executed 7 times instead of just once. Can't figure out what's wrong.

My udev rules file:

Code:
/etc/udev/rules.d# cat 20-stick.rules
ACTION=="add", ATTRS{vendor}=="Kingston", ATTRS{model}=="DataTraveler G2 ", RUN="/usr/local/bin/sync.sh"
Dummy backup script: connecting USB drive results in 7 times date written to /tmp/test
code....

View 2 Replies View Related

Ubuntu :: Open Up Home Folder Multiple Times ?

May 18, 2011

I am running 11.04 with the Unity environment from a USB stick. With "Ubuntu Classic", I can open up my Home folder multiple times and thus copy files from one location to another with drag and drop. In Unity, it seems I can only open up one occurrence of the Home folder. Does anyone know if multiple Home folders can be opened up?

View 1 Replies View Related

Software :: Bash Syntax - While Loop With Multiple Comparison Operators

Apr 21, 2009

I'm trying to code the following WHILE loop in Bash:
While [string1 is non zero] and [string2 is non zero] and [counter < max]
Do
...
Done

I can't get the syntax right. I've tried:
Code:
while [ -n "$STRING1"] -a [ -n "$STRING2"] -a [$COUNTER -lt $MAX ]
But I get 'Too may arguments'

View 4 Replies View Related

OpenSUSE :: Multiple Times To Get The Knetworkmanager To Connect To An Unencrypted Network?

Aug 19, 2010

I just don't get it? I've attempted multiple times to get the knetworkmanager to connect to an unencrypted network, yet it keeps asking for a wep key. However the networkmanager in the Gnome version connects to unencrypted networks just fine. Why won't knetwork manager do the same?

View 9 Replies View Related

Ubuntu Security :: Keyring Login Prompts Multiple Times

Nov 9, 2010

It's been awhile since I've been on here. I suppose that can be considered a good thing, since I made the completely transfer to Ubuntu three months ago and everything's been running completely smoothly. Anyway, security is a pretty big thing to me. I usually change the root password, take sudo off (and default gksu, not gksudo), encrypt my hard drives, etc... One thing I also do is create a separate password for my login keyring. I don't mind having to enter one extra password at login, but it started prompting two times, and now three. It's the same password every time, so my question is..

View 4 Replies View Related

Ubuntu Networking :: NFS Mount Shows Multiple Times In The Places?

Mar 23, 2011

I have the follwoing fenomenan. In my /etc/fstab I have an entry to automatically mount my NAS. Here is my entry:

192.168.1.10:/mnt/array1/My_NAS /media/My�40NAS nfs _netdev,
auto,rw,hard,users,intr 0 0

When my laptop boots it successfully mounts the NFS NAS and I get an icon "My NAS" on my dekstop that points to the NAS. If I double click on the icon it opens my file browser and I can browse thru my NAS fodlers.

What I see on the left hand side of the file browser is that I have to entries for My NAS. One of it has a button to shows that it is mounted and the other does not.

If I go to Places I also see 2 entries for "My NAS". One of it takes me to browsing the NAS and if I click on the other it says "Unable to mount ... busy or already mounted". Which makes sense.

View 4 Replies View Related

OpenSUSE Install :: Update Fails - Loop - Flash Player - Yast2-core

Aug 27, 2011

I am trying to update Flash-player and yast2-core as prompted by today's update icon.

I am now faced with a loop that goes like this:
1) click on icon
2) window pops up, "2 packages selected"
3) click on apply, subwindow pops up
4) click on continue, "waiting for authentication"
5) after minutes of waiting, click on cancel, nothing happens
6) click on icon killing subwindow
7) now back to 2)

Aborting the process, starting at 1) again, same mess

Conclusions:
a) No idea what was going on

b) Use Yast instead of clicking update icon

View 2 Replies View Related

General :: Making Specific Script Loop Over Multiple Files In Directory?

May 10, 2011

I am trying - to no avail - to take an old script I found in the forum help-needed-in-grep-for-tar-gz-658730/ The code:

Code:
#!/bin/bash
if zgrep $1 $2 > /dev/null 2>&1

[code]....

View 3 Replies View Related

Ubuntu Multimedia :: Flash Player 10 - Downloaded It Multiple Times - Nothing Is Working

Apr 10, 2010

I'm using ubuntu 8.04, and when I load some things, like some games, it tells me I need flash player 10. I have downloaded it multiple times and installed it multiple times but nothing is working as it should. Is it because I'm still on 8.04?

View 5 Replies View Related







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