From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,f1ba4ce1bb11d7f5,start X-Google-Attributes: gidfee84,public From: haymanR@icefog.uacn.alaska.edu (Randy M. Hayman) Subject: mkdir(2) then fopen(file, "w") under it failure Date: 1995/04/27 Message-ID: <3nolo3$r1e@news.alaska.edu>#1/1 X-Deja-AN: 101597642 distribution: world organization: University of Alaska Computer Network keywords: mkdir(2), C2 security, fopen, creat reply-to: haymanr@icefog.uacn.alaska.edu newsgroups: comp.unix.osf.osf1 Greetings - I am running Digital UNIX (aka OSF/1) v3.2 r214 with Enhanced Security. I have some C code which I am working on and am getting a failure on both calls to creat() and fopen() after a successful mkdir(). Errno indicates "No such file or directory". So I then add an if( NULL == (dst_dfd = opendir(dst_dir)) ) fprintf(stderr,"copy_dir: Can't open dst_dir (%s).\n", dst_dir); else closedir(dst_dfd); and sure enough, after a successful mkdir(), the directory in question can't be opened. Now this has me befuddled, because when the routine then exits, I look and the directory does exist. What am I missing? The routine is running suid root, so permissions aren't an issue. I also succeed with mkdir() call under the first mkdir(). Source code for cp.c hasn't helped in pinpointing my problem yet either (since I'm basically doing a cp -R src_dir dst_dir). Also, there was a question recently about Enhanced Security forcing a mask of 077 on mkdir() creates regardless of the mode passed. Has that been answered/summarized yet? The workaround I'm using is to mkdir() immediately followed by chmod() with the same modes as sent to mkdir(). TIA. Summary pending responses. -- Randy M. Hayman haymanr@icefog.alaska.edu "Ethernet works in practice but not in theory" -- Bob Metcalfe