This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/16285] thread-safe file locking (using lock file)


https://sourceware.org/bugzilla/show_bug.cgi?id=16285

--- Comment #4 from Wolfgang Sourdeau <wolfgang at contre dot com> ---
(In reply to Rich Felker from comment #3)
> Normally for this kind of thing, you write into a unique temporary file and
> rename (which is atomic) to the actual name only when the file is complete.
> This avoids all the issues you're concerned about, I believe.

(thank you for your quick responses!)

Actually the problem is still the same, for the reason that renaming can
overwrite the target file, which does not solve the race condition.
The other solution I thought about was to hard link a file, since this too
renders the file content atomically, but then it requires an unlink + link
phase which causes the race condition again.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]