[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Safe File Update (atomic)



On Thu, 30 Dec 2010, Henrique de Moraes Holschuh wrote:
> BTW: safely removing a file is also tricky.  AFAIK, one must open it RW,
> in exclusive mode. stat it by fd and check whether it is what one
> expects (regular file, ownership).  unlink it by fd.  close the fd.

Eh, as it was pointed to me by private mail, this is obviously a load of
crap :p  There is no unlink by fd.  Sorry about that.

The attacks here are races by messing with intermediate path components,
which are either not worth bothering with, or have to be avoided in a
much more convoluted manner.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


Reply to: