Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ptsfa!ames!pasteur!ucbvax!decvax!decwrl!hplabs!hp-pcd!uoregon!omepd!intelisc!shannon From: shannon@intelisc.UUCP (Shannon Nelson) Newsgroups: comp.lang.c Subject: Re: system (and mkdir) Keywords: c program Message-ID: <224@intelisc.UUCP> Date: 22 Jan 88 18:00:53 GMT References: <127@dcrbg1.UUCP> <9472@ccicpg.UUCP> <2771@cbdkc1.ATT.COM> Reply-To: shannon@intelisc.UUCP (Shannon Nelson) Organization: Intel Scientific Computer, Beaverton, OR Lines: 29 In article <2771@cbdkc1.ATT.COM> pmd@cbdkc1.UUCP (Paul Dubuc) writes: >In article <9472@ccicpg.UUCP> miket@ccicpg.UUCP (Mike Tracy) writes: >} >}The best example I have [of system()] is the mkdir command. Since a normal >}user can not create a directory. The mkdir (under Unix) is a SUID root >}program... >} >}To make a directory from you C program [...] you must use the system call >} >} system( "mkdir mydir" ); > >No, you don't have to you system() for this. You can use fork()/exec(). I may be showing my ignorance, but what ever happened to the mkdir() call? In my manuals (Xenix, sysVr3, Pyramid OSx) neither the call nor the command say anything about set-uid to root. A quick ls -l of /bin/mkdir confirms this. As long as the effective user id has write permission in the target directory, both "mkdir(path, mod)" and "mkdir path" should be successful. Given this, and the overhead inherent in system(), why are you not using mkdir()? -- ============================================================================ Shannon Nelson ...!tektronix!ogcvax!intelisc!shannon (503) 629-7607 "Live, from iSC Evaluation ..." Intel disclaims all knowledge of my existence.