summaryrefslogtreecommitdiffstats
path: root/bin/sh/main.c
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1996-12-21 22:09:40 +0000
committersteve <steve@FreeBSD.org>1996-12-21 22:09:40 +0000
commitcd89de39c0ce0744e9da3e3182885db84fe72fe9 (patch)
tree3f344113428cac8e3035af328195e1a4aea0a72e /bin/sh/main.c
parent6be6d65a0219c5adcff0f44fe92d1f1911d7d216 (diff)
downloadFreeBSD-src-cd89de39c0ce0744e9da3e3182885db84fe72fe9.zip
FreeBSD-src-cd89de39c0ce0744e9da3e3182885db84fe72fe9.tar.gz
Make sh(1) a little braver in the face of adversity. sh(1)
now handles the getpwd() init problem the same way as bash and ksh do. Also while I was in here, I cleaned up the format a little, removed some unnnecessary #if SYMLINKS cruft, and changed the pwd builtin to use getcwd(3) as Joerg suggested.
Diffstat (limited to 'bin/sh/main.c')
-rw-r--r--bin/sh/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/main.c b/bin/sh/main.c
index 55f340c..9083e56 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: main.c,v 1.9 1996/10/29 03:12:47 steve Exp $
+ * $Id: main.c,v 1.10 1996/12/14 06:19:19 steve Exp $
*/
#ifndef lint
@@ -171,7 +171,8 @@ main(argc, argv)
init();
setstackmark(&smark);
procargs(argc, argv);
- getpwd();
+ if (getpwd() == NULL && iflag)
+ out2str("sh: cannot determine working directory\n");
if (argv[0] && argv[0][0] == '-') {
state = 1;
read_profile("/etc/profile");
OpenPOWER on IntegriCloud