Ahouxm.142 net.unix-wizards utzoo!decvax!duke!chico!harpo!floyd!houxi!houxm!3723edm Wed Jan 27 22:59:39 1982 file locking problem I have come across a programming problem on release 3.0 and 4.0 that is easy to solve except when the program is run setuid to root. The program I am modifying is part of a package called `at'. It must create a file with a unique name. Since the file is guaranteed to be mode 444, creat could be used, and would be guaranteed to fail if the file already existed---except that the program is run as root. An easy answer is to use access(2) to find out if the file exists, and as long as the access fails, do a creat. The problem with this is that in the short span of time between the access and the creat calls, another invocation might have done a creat on the same name. Short of forking and doing a setuid to a non-root uid, or a change to the kernel, is there a way around this? Eli Mantel (houxm!3723edm)