system
Paul Dubuc
pmd at cbdkc1.ATT.COM
Wed Feb 3 01:39:16 AEST 1988
In article <7 at obie.UUCP> wes at obie.UUCP (Barnacle Wes) writes:
}On System V, directories are made with the system call mknod(2).
}To make the directory '/usr/fool' with rwxrwxr-x permissions,
}you would use:
}
} mknod("/usr/fool", 040775, 0);
}
}The mode bits are: 040000: make directory, 0775: permission bits.
It's already been mentioned that System Vr3 has a mkdir() call, but
in the older systems, this still won't do the whole job of making
a directory. After the mknod(), you need two calls to link() to make
it properly:
link("/usr/fool", "/usr/fool/.");
link("/usr", "/usr/fool/..");
This *still* requires the calling program to have super-user permission,
so I think the solution of using a routine that exec's the mkdir comand
is better. I never understood why making directories was a super user
priviledge. Can someone enlighten me? Since they changed it in r3 of
sys V, there must not have been a good reason.
--
Paul Dubuc {ihnp4,cbosgd}!cbdkc1!pmd
More information about the Comp.lang.c
mailing list