Date: Sat, 4 Aug 2007 22:13:41 +0100 From: RW <fbsd06@mlists.homeunix.com> To: freebsd-questions@freebsd.org Subject: Re: How does Sendmail know how it was invoked? Message-ID: <20070804221341.6880cbb4@gumby.homeunix.com.> In-Reply-To: <200708041548.11996.don.hinton@vanderbilt.edu> References: <20070804190634.69234e1e@gumby.homeunix.com.> <20070804182307.GD77822@dan.emsphone.com> <20070804211334.782c37ff@gumby.homeunix.com.> <200708041548.11996.don.hinton@vanderbilt.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 4 Aug 2007 15:48:11 -0500 Don Hinton <don.hinton@vanderbilt.edu> wrote: > On Saturday 04 August 2007 15:13:34 RW wrote: > > On Sat, 4 Aug 2007 13:23:07 -0500 > > > > What I didn't get was that when a binary is executed from execve(), > > it's the parent program that sets the argv[0] seen by the child, > > and not the kernel. > > Sorry, I should have paid closer attention to your question and > actually looked at the code to see what they were doing in this > specific case. > > They original args, including argv[0], are passed as args parameter > to execve. So from the perspective of the called application, the > original argv[0] is now argv[1]. I don't think that's right. As I understand it, the argv argument to execve() is passed-on directly as the child processes arguments, and the parent can write whatever it likes into argv[0] - it's only convention that it's a filename. So mailwrapper passes its own argv[0] as sendmail's argv[0]. And so sendmail behaves as if it had been invoked as mailq or whatever.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070804221341.6880cbb4>