Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2011 21:38:16 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222292 - head/bin/sh
Message-ID:  <201105252138.p4PLcGdt031297@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Wed May 25 21:38:16 2011
New Revision: 222292
URL: http://svn.freebsd.org/changeset/base/222292

Log:
  sh: Show errno messages in cd.

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==============================================================================
--- head/bin/sh/cd.c	Wed May 25 21:17:53 2011	(r222291)
+++ head/bin/sh/cd.c	Wed May 25 21:38:16 2011	(r222292)
@@ -86,6 +86,7 @@ cdcmd(int argc, char **argv)
 	struct stat statb;
 	int ch, phys, print = 0, getcwderr = 0;
 	int rc;
+	int errno1 = ENOENT;
 
 	optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
 	phys = Pflag;
@@ -138,9 +139,11 @@ cdcmd(int argc, char **argv)
 			rc = docd(p, print, phys);
 			if (rc >= 0)
 				return getcwderr ? rc : 0;
+			if (errno != ENOENT)
+				errno1 = errno;
 		}
 	}
-	error("can't cd to %s", dest);
+	error("%s: %s", dest, strerror(errno1));
 	/*NOTREACHED*/
 	return 0;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105252138.p4PLcGdt031297>