summaryrefslogtreecommitdiff
path: root/Python/getcwd.c
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-05-05 20:24:30 +0000
committerBrett Cannon <bcannon@gmail.com>2010-05-05 20:24:30 +0000
commit417439e6cdc072baea8217a3c60d5f52f353394a (patch)
treebee8ca0494b876a5b281428f9de935876a2d9e2b /Python/getcwd.c
parent0b03f10afb301560c711b953b6ca2ecef3181eed (diff)
downloadcpython-git-417439e6cdc072baea8217a3c60d5f52f353394a.tar.gz
Partially revert the over-reaching r80813.
Diffstat (limited to 'Python/getcwd.c')
-rw-r--r--Python/getcwd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/getcwd.c b/Python/getcwd.c
index 36fcd5ceff..967d484b35 100644
--- a/Python/getcwd.c
+++ b/Python/getcwd.c
@@ -28,7 +28,7 @@ getcwd(char *buf, int size)
{
char localbuf[MAXPATHLEN+1];
char *ret;
-
+
if (size <= 0) {
errno = EINVAL;
return NULL;
@@ -59,13 +59,14 @@ getcwd(char *buf, int size)
{
FILE *fp;
char *p;
+ int sts;
if (size <= 0) {
errno = EINVAL;
return NULL;
}
if ((fp = popen(PWD_CMD, "r")) == NULL)
return NULL;
- if (fgets(buf, size, fp) == NULL || pclose(fp) != 0) {
+ if (fgets(buf, size, fp) == NULL || (sts = pclose(fp)) != 0) {
errno = EACCES; /* Most likely error */
return NULL;
}