logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 186cad649c4947f330f6624b7d10c797c59abef9
parent 4cc41cb31b2f541937b769dd14765f305657d2ae
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  8 Sep 2025 01:27:44 +0200

cmd/touch: handle EMLINK (FreeBSD) & EFTYPE (NetBSD)

Diffstat:

Mcmd/touch.c8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/cmd/touch.c b/cmd/touch.c @@ -282,6 +282,14 @@ main(int argc, char *argv[]) int fd = open(file, open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); if(fd == -1) { + /* BSD nonsense */ +#ifdef EMLINK + if(errno == EMLINK) errno = ELOOP; +#endif +#ifdef EFTYPE + if(errno == EFTYPE) errno = ELOOP; +#endif + if(errno == EISDIR || (errno == ELOOP && FIELD_MATCH(open_flags, O_NOFOLLOW))) { if(utimensat(AT_FDCWD, file, times, utimensat_flags) != 0)