Ahouxm.142 net.unix-wizards utcsrgv!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) ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.