Article 5DJK3 EISDIR errors for rename(2)

EISDIR errors for rename(2)

by
Skaperen
from LinuxQuestions.org on (#5DJK3)
for non-directory objects with appropriate ownership and permission, rename(2) can replace the target object with the source object. but if the target object is an empty directory, rename(2) will give an EISDIR error, even if the ownership and permissions would allow rmdir(2) to remove it. this requires the calling code to rmdir(2) to replace it, opening a gap of time that another process could put an object there, perhaps a directory.

by letting rename(2) replace the target when the right conditions exist (permissions are appropriate and the directory is empty, it can do it atomically.

does anyone know why this is not allowed? it would seem to me that rename(2) calling rmdir(2) would be safe inside the kernel lock.latest?d=yIl2AUoC8zA latest?i=2NCSn1WN-eI:flHTQolGJcA:F7zBnMy latest?i=2NCSn1WN-eI:flHTQolGJcA:V_sGLiP latest?d=qj6IDK7rITs latest?i=2NCSn1WN-eI:flHTQolGJcA:gIN9vFw2NCSn1WN-eI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments