Date: Wed, 10 Apr 2024 17:33:30 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 271675] cp: Interrupted system call Message-ID: <bug-271675-227-hSBMTPgqE5@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-271675-227@https.bugs.freebsd.org/bugzilla/> References: <bug-271675-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271675 --- Comment #9 from Ivan Rozhuk <rozhuk.im@gmail.com> --- I suspect that more correct is ignore EINTR error limited times and only th= en fallback to generic copy. So IMHO usage pattern must be one of: size_t ntry; const size_t max_ntry =3D 5; for (ntry =3D 0; ntry < max_ntry;) { int ret =3D copy_file_range(...); if (0 < ret) { ntry =3D 0; continue; } if (0 =3D=3D ret) break; /* Err handle. */ if (EINTR !=3D errno) break; ntry ++; /* Probably nanosleep() here. */ } if (ntry =3D=3D max_ntry) { /* Fail, do fallback code. */ } Or int ret; for (;;) { ret =3D copy_file_range(...); if (0 =3D=3D ret || /* Ok, EOF. */ (0 > ret && EINTR !=3D errno)) /* Unhandled error. */ break; } if (0 !=3D ret) { /* Fail, do fallback code. */ } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-271675-227-hSBMTPgqE5>