Index: libutil/abs2rel.c
===================================================================
RCS file: /sources/global/global/libutil/abs2rel.c,v
retrieving revision 1.20
diff -c -r1.20 abs2rel.c
*** libutil/abs2rel.c	22 Jun 2015 06:42:50 -0000	1.20
--- libutil/abs2rel.c	30 Dec 2015 09:19:39 -0000
***************
*** 359,365 ****
  char *
  abs2rel(const char *path, const char *base, char *result, int size)
  {
! 	const char *pp, *bp, *branch;
  	/*
  	 * endp points the last position which is safe in the result buffer.
  	 */
--- 359,365 ----
  char *
  abs2rel(const char *path, const char *base, char *result, int size)
  {
! 	const char *pp, *bp, *branch, *branch_b;
  	/*
  	 * endp points the last position which is safe in the result buffer.
  	 */
***************
*** 384,389 ****
--- 384,390 ----
  	 * seek to branched point.
  	 */
  	branch = path;
+ 	branch_b = base;
  	for (pp = path, bp = base; *pp && *bp; pp++, bp++) {
  #ifdef COLOR_PATH
  		/* skip escape sequence */
***************
*** 401,408 ****
  #endif
  		if (PATHCHAR(*pp) != PATHCHAR(*bp))
  			break;
! 		if (*pp == '/')
  			branch = pp;
  	}
  	if ((*pp == 0 || (*pp == '/' && *(pp + 1) == 0)) &&
  	    (*bp == 0 || (*bp == '/' && *(bp + 1) == 0))) {
--- 402,411 ----
  #endif
  		if (PATHCHAR(*pp) != PATHCHAR(*bp))
  			break;
! 		if (*pp == '/') {
  			branch = pp;
+ 			branch_b = bp;
+ 		}
  	}
  	if ((*pp == 0 || (*pp == '/' && *(pp + 1) == 0)) &&
  	    (*bp == 0 || (*bp == '/' && *(bp + 1) == 0))) {
***************
*** 435,441 ****
  	 * up to root.
  	 */
  	rp = result;
! 	for (bp = base + (branch - path); *bp; bp++)
  		if (*bp == '/' && *(bp + 1) != 0) {
  			if (rp + 3 > endp)
  				goto erange;
--- 438,444 ----
  	 * up to root.
  	 */
  	rp = result;
! 	for (bp = branch_b; *bp; bp++)
  		if (*bp == '/' && *(bp + 1) != 0) {
  			if (rp + 3 > endp)
  				goto erange;
