Path: utzoo!yunexus!hydroesm!jtsv16!torsqnt!news-server.csri.toronto.edu!mailrus!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.unix.questions Subject: Re: mkdir in C Message-ID: <13013@smoke.BRL.MIL> Date: 29 May 90 14:12:27 GMT Article-I.D.: smoke.13013 References: <009375FC.8A3B0AC0@rigel.efd.lth.se> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <009375FC.8A3B0AC0@rigel.efd.lth.se> e89hse@rigel.efd.lth.se writes: > I'd like to know if there is any way for a C-program to create a directory. >The mkdir(2) call doesn't exist on the machine I'm using. It is possible to >create a directory with the mknod(2) call, but then you have to have >effective-user-id 0 (super user). Of course one could set the substitute user >flag, but isn't there a more elegant way to do it. The reason mknod() is protected even for making directory inodes is that you need to also plant the . and .. links, or havoc will ensue. The simplest solution is to invoke the privileged system utility: system("mkdir whatever");