What is Nostr?
Stephen Checkoway /
npub1657…0vqt
2024-09-23 22:41:00

Stephen Checkoway on Nostr: I've always kind of wondered why rmdir(2) only deletes empty directories. (I suppose ...

I've always kind of wondered why rmdir(2) only deletes empty directories. (I suppose it could be simply to keep the recursive directory traversal logic out of the kernel.) One can usually just recursively delete directories so this doesn't matter but I ran across a situation where it does actually matter that rmdir only deletes empty directories that I hadn't considered before.

If directory /containing is writable by user u and directory /containing/private is not writable by user u, then u can delete /containing/private only if /containing/private is empty.

This kind of feels like it's a security/access control choice. Does anyone know if this scenario was an explicit consideration when the rmdir system call was being designed? (The macOS man page suggests that rmdir(2) appeared in 4.2BSD.)
Author Public Key
npub1657n8l9cyg9aflhenew8pnqt8tt2y7c85vdaavsyw0s9c5hxn0fqv90vqt