diff toys/posix/cp.c @ 1404:ffc7f606ce5b draft

Move DIRTREE_COMEAGAIN second callback up to when the filehandle is still open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle.
author Rob Landley <rob@landley.net>
date Sat, 26 Jul 2014 13:30:40 -0500
parents c4f5f82adce6
children 7a3afbc7fc8b
line wrap: on
line diff
--- a/toys/posix/cp.c	Sat Jul 26 13:27:07 2014 -0500
+++ b/toys/posix/cp.c	Sat Jul 26 13:30:40 2014 -0500
@@ -84,7 +84,7 @@
   if (!dirtree_notdotdot(try)) return 0;
 
   // If returning from COMEAGAIN, jump straight to -p logic at end.
-  if (S_ISDIR(try->st.st_mode) && try->data == -1) {
+  if (S_ISDIR(try->st.st_mode) && try->again) {
     fdout = try->extra;
     err = 0;
   } else {