Return ENOTEMPTY to its rightful places
Apparently, System V didn't have ENOTEMPTY, so when Solaris-2/SunOS-5 happened, it disappeared.
Linux, BSDs, and even Posix and SUS say that you can have unlink() and rmdir() return either EEXIST or ENOTEMPTY for rmdir() or unlinkat() with the AT_REMOVEDIR flag set. This LX Brand PR in SmartOS:
inspired this issue.
Unfortunately, as has been discussed on IRC just prior to me filing this, restoring ENOTEMPTY may break a lot of software, not just internally, but also externally, where 3rd-party code assumes rmdir("non-empty") returns EEXIST.
This will not be an easy change to test. ALSO, it appears every filesystem type has to be fixed to take this into account as well. This is categorized in "filesystems (not ZFS)", but it covers ZFS as well.
No data to display