Index: update.c =================================================================== RCS file: /private/FreeBSD/src/contrib/cvs/src/update.c,v retrieving revision 1.12 diff -u -p -r1.12 update.c --- update.c 21 Jan 2003 22:01:38 -0000 1.12 +++ update.c 23 Feb 2004 19:08:34 -0000 @@ -1136,9 +1136,22 @@ update_dirleave_proc (callerdat, dir, er if (strchr (dir, '/') == NULL) { - /* FIXME: chdir ("..") loses with symlinks. */ - /* Prune empty dirs on the way out - if necessary */ - (void) CVS_CHDIR (".."); + char *cdir; + + cdir = getcwd(NULL, 0); + if (cdir == NULL) { + /* FIXME: chdir ("..") loses with symlinks. */ + /* Prune empty dirs on the way out - if necessary */ + (void) CVS_CHDIR (".."); + } else { + char *lastslash; + + lastslash = strrchr(cdir, '/'); + if (lastslash != NULL) + *lastslash = '\0'; + (void) CVS_CHDIR (cdir); + free(cdir); + } if (update_prune_dirs && isemptydir (dir, 0)) { /* I'm not sure the existence_error is actually possible (except