On 10/18/07, Richard Toohey <[EMAIL PROTECTED]> wrote: > # diff -u /tmp/cp.c cp.c > --- /tmp/cp.c Thu Oct 18 21:50:07 2007 > +++ cp.c Thu Oct 18 22:48:37 2007 > @@ -237,6 +237,10 @@ > */ > type = FILE_TO_DIR; > + if (type == FILE_TO_DIR) > + if (strcmp(to.p_path,*argv)==0) > + errx(1,"source and destination directories (% > s) would cause cycle",to.p_path); > + > exit (copy(argv, type, fts_options)); > }
unfortunately, using strcmp fails in many cases where the directory may be accessed using different pathnames. also, this doesn't address the case of more than source argument.