summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cd.c b/src/cd.c
index 2d9d4b5..a4e024d 100644
--- a/src/cd.c
+++ b/src/cd.c
@@ -38,6 +38,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <limits.h>
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif
 
 /*
  * The cd and pwd commands.
@@ -194,6 +197,17 @@ updatepwd(const char *dir)
 	char *cdcomppath;
 	const char *lim;
 
+#ifdef __CYGWIN__
+	/* On cygwin, thanks to drive letters, some absolute paths do
+	   not begin with slash; but cygwin includes a function that
+	   forces normalization to the posix form */
+	char pathbuf[PATH_MAX];
+	if (cygwin_conv_path(CCP_WIN_A_TO_POSIX | CCP_RELATIVE, dir, pathbuf,
+			     sizeof(pathbuf)) < 0)
+		sh_error("can't normalize %s", dir);
+	dir = pathbuf;
+#endif
+
 	cdcomppath = sstrdup(dir);
 	STARTSTACKSTR(new);
 	if (*dir != '/') {
58:20 -0400'>2021-05-08Import LibreSSL 3.3.3June McEnroe 2021-04-18build: Remove added x509_verify.3 links 3.3.2June McEnroe 2021-04-18tls: Use EC_KEY_set_ex_dataJune McEnroe 2021-04-18Import LibreSSL 3.3.2June McEnroe 2021-03-05Bump version to 3.3.1p1 3.3.1p1June McEnroe 2021-03-05build: Add OpenSSL includes to libcompatJune McEnroe Some compat sources (getentropy_linux.c for example) require OpenSSL. Reported by Robert Scheck. 2020-12-15Import LibreSSL 3.3.1June McEnroe 2020-11-24Import LibreSSL 3.3.0June McEnroe 2020-10-22Import LibreSSL 3.2.2June McEnroe 2020-09-29Import LibreSSL 3.2.1June McEnroe 2020-09-29import: Add m4/ax_add_fortify_source.m4June McEnroe 2020-08-05build: Add README.7 to EXTRA_DIST 3.2.0June McEnroe 2020-08-03doc: Indicate that only OpenSSL 1.1.1b and newer workJune McEnroe