why does execv executes twice?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > why does execv executes twice?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    why does execv executes twice?  
puzzlecracker


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-05 08:47 PM

void somefunc(){
newargv[0] = "script";
newargv[1] = "arg1";
newargv[2] = NULL;

pid_t pid;
if(pid=fork()<0)
{
cerr<<"failed in fork(), exit 1\n";
exit(1);

}
else if(pid==0)
{
if(execv("/home/bin/script",newargv)<0)
{
cerr<<"failed in execv(), exit 1\n";
exit(1);
}
}
}






[ Post a follow-up to this message ]



    Re: why does execv executes twice?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-05 08:47 PM

"puzzlecracker" <ironsel2000@gmail.com> writes:

>       if(pid=fork()<0)

Operator precedence: < has higher precedence than =.

--
Måns Rullgård
mru@inprovide.com





[ Post a follow-up to this message ]



    Re: why does execv executes twice?  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-05 08:47 PM

Måns Rullgård <mru@inprovide.com> writes:

> "puzzlecracker" <ironsel2000@gmail.com> writes:
> 
>
> Operator precedence: < has higher precedence than =.

Which means you have to use much more parentheses in C than you think,
which means you could as well write Lisp.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
In deep sleep hear sound,
Cat vomit hairball somewhere.
Will find in morning.





[ Post a follow-up to this message ]



    Re: why does execv executes twice?  
Lew Pitcher


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-05 08:47 PM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pascal Bourguignon wrote:
> Måns Rullgård <mru@inprovide.com> writes:
>
> 
>
>
> Which means you have to use much more parentheses in C than you think,

I should point out that the OP posted C++ code and not C code, and that Måns
reply did not mention C at all.

[snip]

- --
Lew Pitcher
IT Specialist, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

 iD8DBQFDU6meagVFX4UWr64RAqQPAJ0cKBi+97pz
cjwHe/bqRYkbyWZCvACgrs4G
unnXxOon06+zv+7ZyXPi2QU=
=OOBz
-----END PGP SIGNATURE-----





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:07 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register