For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2005 > exec() arguments get confusing









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author exec() arguments get confusing
Bert

2005-05-28, 3:58 pm

Hi,

I'm calling exec() to make a SSH connection to one of my network's
computer using execlp("ssh","ssh","compname",...,(char*)0), where the
.... stands for further arguments one would pass to 'ssh'.
The problem I'm getting is that about 40% of the time i make such a
call, 'ssh' reports that "ssh: unknown host" as if it took the first
argument argv[0] (which is usually the name of the executable) as the
host I'm trying to connect to instead of using 'compname'.
The weird thing is that it's not systematic and using
execlp("ssh","compname",...,(char*)0) won't work.

Any ideas?
(I'm on Linux 2.6.8)

Thanks in advance for any help

Paul Pluzhnikov

2005-05-28, 3:58 pm

"Bert" <bad_bert@hotmail.com> writes:

> The weird thing is that it's not systematic


There is probably a bug in your program. Try creating a minimal test
case that still shows the problem, and your bug will be revealed.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Bert

2005-05-28, 8:57 pm

Ok but do you confirm that the correct call to execlp() is
execlp("ssh","ssh",...,(char*)0) where as usual, ... stands for
arguments passed to ssh ?

Thanks

Paul Pluzhnikov a =E9crit :
> "Bert" <bad_bert@hotmail.com> writes:
>
>
> There is probably a bug in your program. Try creating a minimal test
> case that still shows the problem, and your bug will be revealed.
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.


Barry Margolin

2005-05-28, 8:57 pm

In article <1117314500.559087.34790@o13g2000cwo.googlegroups.com>,
"Bert" <bad_bert@hotmail.com> wrote:

> Ok but do you confirm that the correct call to execlp() is
> execlp("ssh","ssh",...,(char*)0) where as usual, ... stands for
> arguments passed to ssh ?


Yes.
[color=darkred]
>
> Paul Pluzhnikov a écrit :

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com