Re: execve() x system()

From: Gigi Sullivan (sullivanat_private)
Date: Sun Jun 24 2001 - 11:54:15 PDT

  • Next message: Glynn Clements: "Re: execve() x system()"

    Aiee :)
    
       Hello!
    
    On Fri, Jun 22, 2001 at 02:10:03PM -0300, Leonardo Chiquitto Filho wrote:
    > I wrote a more friendly interface to useradd.
    > The problem is, I call 'useradd user' with execve()
    > and then getpwname(user). At this point getpwname
    > returns me NULL. Trying with system() it works.
    > Any idea?
    
       If you call getpwnam(3) right after execve(2), then it's normal
       that it fails.
    
       execve replace the current process image with the one that gets
       executed.
    
       Try to do it by yourself (setpwnam(3) and so on) instead of calling
       execve, otherwise you have to fork() (clone, whatever you like) than 
       let one process (child maybe) to execute something, than make the parent 
       wait for its child's death.
       
       Make some sanity check always. :)
    
    > nate
    
    bye bye
    
                         -- gg sullivan
    
    -- 
    Lorenzo Cavallaro	`Gigi Sullivan' <sullivanat_private>
    
    Until I loved, life had no beauty;
    I did not know I lived until I had loved. (Theodor Korner)
    



    This archive was generated by hypermail 2b30 : Sun Jun 24 2001 - 17:36:08 PDT