This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with setuid/execv on Cygwin/Windows 7


On Nov  9 10:08, Corinna Vinschen wrote:
> On Nov  9 08:59, Laurent Cocault wrote:
> > Hi Cygwin community,
> > 
> > I am currently facing a problem with the combination of setuid/execv on a Cygwin/Windows 7.
> > [...]
> >     char* args[1];
> >     args[0] = NULL;
> >     status = execv("/bin/bash", args);
> 
> This is wrong.  You should at least set args[0] since that what becomes
> argv[0] in the child process:
> 
>       char* args[2];
>       args[1] = "bash";
>       args[2] = NULL;

Ouch.  ENOCOFFEE.  Make that

        args[0] = "bash";
        args[1] = NULL;

>       status = execv("/bin/bash", args);


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]