grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Create environment block safely


From: address@hidden
Subject: Re: [PATCH] Create environment block safely
Date: Fri, 2 Oct 2009 10:05:58 -0500

>> You might also need to check for the alternate name, in case the
>> operation failed after writing the new content and unlinking the old
>> file, but before renaming the new file.
>
> There is no old file here, or if there is then the user has already
> explicitly indicated that they don't care about it. There is no unlink
> call in my code (and wouldn't be even if this weren't a create
> operation; no need to bother when you're renaming over the top anyway).

I guess I didn't look closely enough at the rename docs:

The rename() system call causes the link named old to be renamed as new.
     If new exists, it is first removed.  Both old and new must be of the same
     type (that is, both must be either directories or non-directories) and
     must reside on the same file system.

     The rename() system call guarantees that an instance of new will always
     exist, even if the system should crash in the middle of the operation.


So my unease was unfounded.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]