How to set file permissions in Init task?

Joel Sherrill joel.sherrill at OARcorp.com
Thu Jan 25 22:04:07 UTC 2001



OUTWATER ~ KEITH J /5G3110 wrote:
> 
> Joel -
> I was doing everything right except for this: chmod("/tmp", 0x777);
> 
> I should have known better.  chmod("/tmp", S_IRWXU | S_IRWXG | S_IRWXO);
> works fine.

Out of curiousity is this because 0x777 does not equal 0777 (octal)?
I would hope that was the case. :)
 
> Keith
> 
> > OUTWATER ~ KEITH J /5G3110 wrote:
> > >
> > > Greetings all -
> > >
> > > I use Untar_Frommemory() to set up an initial file system which includes a
> > > "/tmp" directory.
> > >
> > > I am attempting to make this directory read/write by everyone in the Init
> task,
> > > but chmod() fails (not owner).
> > >
> > > Where, then, is the right place to set this permission?
> >
> > Before you create the tar image.   My thinking is that the image on your
> > local disk before you tar is exactly what you want to untar, permissions
> > included.  There might be some tricks with seteuid() or something to make
> > this work out easier.  I would not expect you to need to change permissions
> > after untar'ing.
> >
> > > Thanks!
> > >
> > > Keith
> > >
> > > Keith Outwater
> > > Principal Engineer
> > > Raytheon Missile Systems
> > > Tucson, AZ
> > >
> > > (520) 794-2518
> > > vac4050 at nospam.cae597.rsc.raytheon.com
> >
> > --
> > Joel Sherrill, Ph.D.             Director of Research & Development
> > joel at OARcorp.com                 On-Line Applications Research
> > Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> > Support Available                (256) 722-9985
> >

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list