Re: lug-bg: "C" wapros
- Subject: Re: lug-bg: "C" wapros
- From: luben@xxxxxxxxxxxxx (Luben Karavelov)
- Date: Wed, 17 May 2000 17:53:49 +0300
On Wed, May 17, 2000 at 10:04:59AM +0300, Valery Dachev wrote:
> On Tue, 16 May 2000, luben karavelov wrote:
>
> > Georgi Chorbadzhiyski wrote:
> > >
> > > Ako mozhe niakoi po svetnat da pomogne. Imam slednata programa
> > > ...
> > script. Na purvia red directivata !/bin/sh e directiva kym shell-a,
> > akavto niamash, kogato izpulniavash exec().
>
> Na dali towa e prichinata da dade EFAULT ("Bad address").
>
99% siguren sam che tova e prichinata.
kakvo prqaviat seriata funkcii exec(), t.e. execv(), execl(), execvp()
i t.n. - ami zarezhdat ukazania v argumemta fail v segmenta na
izpulnimia kod i mu predadat upravlenieto.
V opisania sluchai tova, koeto se naricha "process image" e textov
fail, koito niama nikakav shans da "trugne" da se izpulniava. za da se
ispulni, triabva da se zaredi kato "process image" interpretator,
koito da go izpulni. komadata sledovatelno triabva da e:
execv("/bin/sh","sh","/usr/local/my_script",NULL);
ili ako iskash da napravish taka che scripta da se izpulni kato nov
process:
ystem("/usr/bin/local/my_script");
tova e
Luben
==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
Otpiswaneto RABOTI !!! : Majordomo@xxxxxxxxxxxxxxxxxx UNSUBSCRIBE LUG-BG
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|