Change #264227
| Category | gcoreutils |
| Changed by | Collin Funk <collin.funk1@gmail.com> |
| Changed at | Sat 11 Apr 2026 18:58:13 |
| Repository | git://git.savannah.gnu.org/coreutils.git |
| Project | gcoreutils |
| Branch | master |
| Revision | 79a6da3be7a815f252ba3195518c9f115cb5ffa3 |
Comments
mktemp: prefer rmdir and unlink to remove
This avoids the following behavior:
$ strace -e silence=exit -e trace=unlink,rmdir \
mktemp -d > /dev/full
unlink("/tmp/tmp.ZBuPmS9ZGD") = -1 EISDIR (Is a directory)
rmdir("/tmp/tmp.ZBuPmS9ZGD") = 0
mktemp: write error: No space left on device
In the above invocation we know that we created a directory, so we
should not remove a regular file that must have been created by another
process:
$ strace -e silence=exit -e trace=unlink,rmdir \
./src/mktemp -d > /dev/full
rmdir("/tmp/tmp.hGbME1HmJr") = 0
mktemp: write error: No space left on device
* src/mktemp.c (main): Prefer rmdir and unlink depending on whether we
created a directory or regular file.
* bootstrap.conf (gnulib_modules): Remove the remove module.
Changed files
- bootstrap.conf
- src/mktemp.c