summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2010-03-25 23:38:29 +0000
committerDamien Miller <djm@cvs.openbsd.org>2010-03-25 23:38:29 +0000
commit24cc4f71fd6ff2e6cefcd1d3a98448ea2a5b5a2d (patch)
treefcdb367d0b1728ca09a36aa1b607768718292e18
parent3eb08fb47bcf0e1ec01c27c5277f79a45dc710c0 (diff)
from portable: getcwd(NULL, 0) doesn't work on all platforms, so
use a stack buffer; ok dtucker@
-rw-r--r--usr.bin/ssh/servconf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index a6d85eba3c4..db4f794a0c8 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/servconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.206 2010/03/12 11:37:40 markus Exp $ */
+/* $OpenBSD: servconf.c,v 1.207 2010/03/25 23:38:28 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -433,15 +433,14 @@ parse_token(const char *cp, const char *filename,
char *
derelativise_path(const char *path)
{
- char *expanded, *ret, *cwd;
+ char *expanded, *ret, cwd[MAXPATHLEN];
expanded = tilde_expand_filename(path, getuid());
if (*expanded == '/')
return expanded;
- if ((cwd = getcwd(NULL, 0)) == NULL)
+ if (getcwd(cwd, sizeof(cwd)) == NULL)
fatal("%s: getcwd: %s", __func__, strerror(errno));
xasprintf(&ret, "%s/%s", cwd, expanded);
- free(cwd);
xfree(expanded);
return ret;
}