GNU bug report logs -
#12945
Assume POSIX 1003.1-1988 or later for unistd.h.
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Tue, 20 Nov 2012 17:41:02 UTC
Severity: normal
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Date: Tue, 20 Nov 2012 20:14:55 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 12945 <at> debbugs.gnu.org
>
> > It may help in a later patch to simplify the Microsoft side by
> > removing getwd and standardizing on getcwd, since that's what
> > POSIX did back in 1988, but that's an issue that's independent
> > of this patch.
>
> It's not independent. The getwd in w32.c must be modified to be
> getcwd instead.
Here's the patch for that:
=== modified file 'src/w32.c'
--- src/w32.c 2012-11-17 22:12:47 +0000
+++ src/w32.c 2012-11-20 20:11:08 +0000
@@ -901,8 +901,18 @@ static char startup_dir[MAXPATHLEN];
/* Get the current working directory. */
char *
-getwd (char *dir)
+getcwd (char *dir, int dirsize)
{
+ if (!dirsize)
+ {
+ errno = EINVAL;
+ return NULL;
+ }
+ if (dirsize < strlen (startup_dir) + 1)
+ {
+ errno = ERANGE;
+ return NULL;
+ }
#if 0
if (GetCurrentDirectory (MAXPATHLEN, dir) > 0)
return dir;
This bug report was last modified 12 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.