so who has mkdir and rmdir for non-4.2 systems
kre at munnari.UUCP
kre at munnari.UUCP
Mon Jul 14 03:24:14 AEST 1986
To emulate 4.[23]'s mkdir()/rmdir() correctly, you have to
be able to do the right thing when the invoking program is
setuid to someone.
That absolutely rules out using system("mkdir") or popen("mkdir")
as the mkdir program is setuid root, and it won't inherit the
correct "real" uid (the effective uid of the calling program).
I can't locate the right Sys V manual to be able to determine
if it can be done sensibly with fork()/exec*() and a setuid()
of some variety in between.
On v7, 4.1bsd, etc, this is a hard problem, don't expect to be
able to solve it quickly!
Neither of the posted mkdir()'s had the args right either.
4.[23]'s mkdir is mkdir(path, mode) not mkdir(path). Of
course, its trivial to add a umask to fix this (nb: not
a chmod after the directory is made, or there will be a window
when it exists without the correct permissions, which could
be fatal).
Robert Elz seismo!munnari!kre kre%munnari.oz at seismo.css.gov
More information about the Comp.unix.wizards
mailing list