X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=pwd.c;h=f6a00bf1e655cba751ba6a26e443dd13398a04ae;hb=a283157c3832f151fa9f5abf5f18c56d05e5815d;hp=19494a96cbd6d840d9037d3655834c09e9530fdf;hpb=7ab9c7ee52db8759d457819f5480378fa3aa97cc;p=oweals%2Fbusybox.git diff --git a/pwd.c b/pwd.c index 19494a96c..f6a00bf1e 100644 --- a/pwd.c +++ b/pwd.c @@ -21,18 +21,24 @@ * */ -#include "internal.h" +/* getopt not needed */ + #include #include #include +#include +#include +#include "busybox.h" extern int pwd_main(int argc, char **argv) { - char buf[BUFSIZ + 1]; - - if (getcwd(buf, sizeof(buf)) == NULL) - fatalError("pwd: %s", strerror(errno)); - - printf("%s\n", buf); - exit(TRUE); + static char *buf; + + buf = xgetcwd(buf); + + if (buf != NULL) { + puts(buf); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; }