trash portal: Fix permission checks
Implement the approach suggested in !276 (merged)
- Try to open O_RDWR. On success, pass that fd
- If EACCESS => fail the trash op, we "need" read-write to successfully trash it
- If EISDIR => re-open the fd with O_PATH, and pass that (which will fail on snap, but verify the dir for flatpaks)
Edited by Philip Withnall