diff options
author | tjr <tjr@FreeBSD.org> | 2002-07-19 08:09:04 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-07-19 08:09:04 +0000 |
commit | 6f7073eccfff9802f5282b17f14d246f99bee922 (patch) | |
tree | 24752195ccbd3015a4f1eda248e246c2af4499c0 /bin/sh/cd.c | |
parent | 641f1fb7d0b2461a61096b8e3cc44c93df53b05e (diff) | |
download | FreeBSD-src-6f7073eccfff9802f5282b17f14d246f99bee922.zip FreeBSD-src-6f7073eccfff9802f5282b17f14d246f99bee922.tar.gz |
Remove broken and incomplete support for old releases of System V,
don't support system that implement getcwd(3) with a pipe to /bin/pwd.
Diffstat (limited to 'bin/sh/cd.c')
-rw-r--r-- | bin/sh/cd.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/bin/sh/cd.c b/bin/sh/cd.c index 9121dc4..fcc0630 100644 --- a/bin/sh/cd.c +++ b/bin/sh/cd.c @@ -369,20 +369,6 @@ getpwd(void) if (curdir) return curdir; - /* - * Things are a bit complicated here; we could have just used - * getcwd, but traditionally getcwd is implemented using popen - * to /bin/pwd. This creates a problem for us, since we cannot - * keep track of the job if it is being ran behind our backs. - * So we re-implement getcwd(), and we suppress interrupts - * throughout the process. This is not completely safe, since - * the user can still break out of it by killing the pwd program. - * We still try to use getcwd for systems that we know have a - * c implementation of getcwd, that does not open a pipe to - * /bin/pwd. - */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__SVR4) - if (getcwd(buf, sizeof(buf)) == NULL) { char *pwd = getenv("PWD"); struct stat stdot, stpwd; @@ -397,47 +383,6 @@ getpwd(void) return NULL; } curdir = savestr(buf); -#else - { - char *p; - int i; - int status; - struct job *jp; - int pip[2]; - INTOFF; - if (pipe(pip) < 0) - error("Pipe call failed: %s", strerror(errno)); - jp = makejob((union node *)NULL, 1); - if (forkshell(jp, (union node *)NULL, FORK_NOJOB) == 0) { - (void) close(pip[0]); - if (pip[1] != 1) { - close(1); - copyfd(pip[1], 1); - close(pip[1]); - } - (void) execl("/bin/pwd", "pwd", (char *)0); - error("Cannot exec /bin/pwd"); - } - (void) close(pip[1]); - pip[1] = -1; - p = buf; - while ((i = read(pip[0], p, buf + MAXPWD - p)) > 0 - || (i == -1 && errno == EINTR)) { - if (i > 0) - p += i; - } - (void) close(pip[0]); - pip[0] = -1; - status = waitforjob(jp); - if (status != 0) - error((char *)0); - if (i < 0 || p == buf || p[-1] != '\n') - error("pwd command failed"); - p[-1] = '\0'; - } - curdir = savestr(buf); - INTON; -#endif return curdir; } |