<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>