Use xgetcwd
diff --git a/hush.c b/hush.c
index d0b30eb..abc8f6e 100644
--- a/hush.c
+++ b/hush.c
@@ -428,7 +428,7 @@
 		printf("cd: %s: %s\n", newdir, strerror(errno));
 		return EXIT_FAILURE;
 	}
-	getcwd(cwd, sizeof(char)*MAX_LINE);
+	cwd = xgetcwd(cwd);
 	return EXIT_SUCCESS;
 }
 
@@ -567,7 +567,7 @@
 /* built-in 'pwd' handler */
 static int builtin_pwd(struct child_prog *dummy)
 {
-	getcwd(cwd, MAX_LINE);
+	cwd = xgetcwd(cwd);
 	puts(cwd);
 	return EXIT_SUCCESS;
 }
diff --git a/shell/hush.c b/shell/hush.c
index d0b30eb..abc8f6e 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -428,7 +428,7 @@
 		printf("cd: %s: %s\n", newdir, strerror(errno));
 		return EXIT_FAILURE;
 	}
-	getcwd(cwd, sizeof(char)*MAX_LINE);
+	cwd = xgetcwd(cwd);
 	return EXIT_SUCCESS;
 }
 
@@ -567,7 +567,7 @@
 /* built-in 'pwd' handler */
 static int builtin_pwd(struct child_prog *dummy)
 {
-	getcwd(cwd, MAX_LINE);
+	cwd = xgetcwd(cwd);
 	puts(cwd);
 	return EXIT_SUCCESS;
 }