What I ended up doing was just stripping the program down to like 10 lines of 
code and I have a simple sprintf to create the directory name.
 
What is wierd is that(I haven't done error reporting yet):
 
mkdir("NEWDIRNAME"); works(creates a directory in the current working directory)
 
but mkdir("/tmp/oooo/NEWDIRNAME") doesn't work, I even tried a chdir(which came 
back succcessful) and then wrote the above mkdir("NEWDIRNAME");
 
Anyway..I'm starting to get off-topic.
 
Nevertheless, I got it working minimally to what I wanted to do, so I have a 
great template for a simple MPI program.
 
Thanks to everyone who helped out!!!
 
 
 
 
 
 
This message may contain confidential and/or privileged information.  If you 
are not the addressee or authorized to receive this for the addressee, you must 
not use, copy, disclose, or take any action based on this message or any 
information herein.  If you have received this message in error, please advise 
the sender immediately by reply e-mail and delete this message. Thank you for 
your cooperation.

________________________________

From: Jakob Oestergaard [mailto:[EMAIL PROTECTED]
Sent: Thu 9/28/2006 8:09 AM
To: Robert G. Brown
Cc: Clements, Brent M (SAIC); beowulf@beowulf.org
Subject: Re: [Beowulf] Stupid MPI programming question



On Thu, Sep 28, 2006 at 08:57:28AM -0400, Robert G. Brown wrote:
> On Thu, 28 Sep 2006, Jakob Oestergaard wrote:
...
> Ah, that's it.  I'd forgotten this one and missed the write to a static
> string, although it has bitten me in the past (partly because back in
> the remote K&R past one could nearly always get away with it).  This is
> also a way that buffer overwrite attacks can begin if any nefarious
> human can control the string that is overwritten IIRC...
>
> Although in this particular case, that should have produced a very
> different error than -1 on the mkdir call, should it not?

Well, if the write doesn't give him a segfault and he's allowed to write
to memory that shouldn't be written to, then I guess pretty much
anything can happen after that.

> And he was
> writing out the results string per node right before calling as well, so
> his compiler was probably letting him get away with it or failing in
> some odd way later.

Yup

I wonder if valgrind would have caught it...

>
> >What you probably want to do is:
> >---
> >char foo[1024];          // 1KiB on the stack - writable
> >strncpy(foo, sizeof foo, "my test"); // Assign contents by copying
> >...
> >foo[0] = ' ';             // <- fine
> >---
>
> Absolutely.

Uh, except I meant strncpy(foo, "my test", sizeof foo) of course...

Cheers,

--

 / jakob




_______________________________________________
Beowulf mailing list, Beowulf@beowulf.org
To change your subscription (digest mode or unsubscribe) visit 
http://www.beowulf.org/mailman/listinfo/beowulf

Reply via email to