summaryrefslogtreecommitdiffhomepage
path: root/pwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pwd.c')
-rw-r--r--pwd.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/pwd.c b/pwd.c
index 2f36b1f05..f6a00bf1e 100644
--- a/pwd.c
+++ b/pwd.c
@@ -32,11 +32,13 @@
extern int pwd_main(int argc, char **argv)
{
- char buf[BUFSIZ + 1];
-
- if (getcwd(buf, sizeof(buf)) == NULL)
- perror_msg_and_die("getcwd");
-
- puts(buf);
- return EXIT_SUCCESS;
+ static char *buf;
+
+ buf = xgetcwd(buf);
+
+ if (buf != NULL) {
+ puts(buf);
+ return EXIT_SUCCESS;
+ }
+ return EXIT_FAILURE;
}