<div dir="ltr">i don't understand this code in cp.c, specifically the marked line. because of the `errno = EXDEV` on the first line of this snippet, and the absence of any `errno = 0` in between, what was the `if (errno &&` for?<div><br></div><div>  errno = EXDEV;<br>  if (CFG_MV && toys.which->name[0] == 'm') {<br>   int force = FLAG(f), no_clobber = FLAG(n);<br><br>   if (!force || no_clobber) {<br>    struct stat st;<br>    int exists = !stat(TT.destname, &st);<br><br>    // Prompt if -i or file isn't writable. Technically "is writable" is<br>    // more complicated (022 is not writeable by the owner, just everybody<br>    // _else_) but I don't care.<br>    if (exists && (FLAG(i) || (!(st.st_mode & 0222) && isatty(0)))) {<br>     fprintf(stderr, "%s: overwrite '%s'", toys.which->name, TT.destname);<br>     if (!yesno(0)) rc = 0;<br>     else unlink(TT.destname);<br>    }<br>    // if -n and dest exists, don't try to rename() or copy<br>    if (exists && no_clobber) rc = 0;<br>   }<br>   if (rc) rc = rename(src, TT.destname);<br>!   if (errno && !*trail) *trail = '/';<br>  }<br></div><div><br></div><div>it seems from the history like the EXDEV assignment was for the later test of `errno != EXDEV` and is really meant to be a "did we successfully move?". i don't think that's still valid now the force/clobber code has been added?</div></div>