bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12945: Assume POSIX 1003.1-1988 or later for unistd.h.


From: Eli Zaretskii
Subject: bug#12945: Assume POSIX 1003.1-1988 or later for unistd.h.
Date: Wed, 21 Nov 2012 05:40:30 +0200

> Date: Tue, 20 Nov 2012 12:51:00 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 12945@debbugs.gnu.org
> 
> > Here's the patch for that:
> 
> Thanks.  Won't we need patches elswhere to match?

Some, but not all.  See below.

> Also, how is this related to the "#define getcwd _getcwd" in
> lib-src/ntlib.h?

We might need that for MSVC.  But that's a different issue, since
lib-src programs don't use any code in w32.c.

> --- nt/config.nt      2012-11-17 23:58:56 +0000
> +++ nt/config.nt      2012-11-20 20:44:17 +0000
> @@ -411,11 +411,10 @@
>  /* Define to 1 if you have the `getaddrinfo' function. */
>  #undef HAVE_GETADDRINFO
>  
> -/* Define to 1 if you have the `getcwd' function.
> -   If you think about defining HAVE_GETCWD, don't: the alternative
> -   getwd is redefined on w32.c, and does not really return the current
> +/* Define to 1 if you have the `getcwd' function.  This is
> +   defined on w32.c, and does not really return the current
>     directory, to get the desired results elsewhere in Emacs.  */
> -#undef HAVE_GETCWD
> +#define HAVE_GETCWD 1

This should be removed entirely, since there are no HAVE_GETCWD tests
anymore, right?

> === modified file 'src/msdos.c'
> --- src/msdos.c       2012-11-05 03:18:32 +0000
> +++ src/msdos.c       2012-11-20 20:44:17 +0000
> @@ -3784,7 +3784,7 @@
>    Lisp_Object cmd;
>  
>    /* Get current directory as MSDOS cwd is not per-process.  */
> -  getwd (oldwd);
> +  getcwd (oldwd, sizeof oldwd);

MSDOS is unrelated.  This can be changed or left alone.

> --- src/sysdep.c      2012-11-20 17:33:00 +0000
> +++ src/sysdep.c      2012-11-20 20:44:17 +0000
> @@ -101,7 +101,6 @@
>  #define _P_WAIT 0
>  int _cdecl _spawnlp (int, const char *, const char *, ...);
>  int _cdecl _getpid (void);
> -extern char *getwd (char *);
>  #endif
>  
>  #include "syssignal.h"
> @@ -504,7 +503,7 @@
>        const char *sh = 0;
>  
>  #ifdef DOS_NT    /* MW, Aug 1993 */
> -      getwd (oldwd);
> +      getcwd (oldwd, sizeof oldwd);
>        if (sh == 0)
>       sh = (char *) egetenv ("SUSPEND");      /* KFS, 1994-12-14 */
>  #endif

This is needed.

> === modified file 'src/w32.h'
> --- src/w32.h 2012-10-17 19:02:44 +0000
> +++ src/w32.h 2012-11-20 20:44:17 +0000
> @@ -163,7 +163,7 @@
>  extern void register_child (int, int);
>  
>  extern void sys_sleep (int);
> -extern char *getwd (char *);
> +extern char *getcwd (char *, size_t);
>  extern int sys_link (const char *, const char *);

This isn't needed; the prototype for getcwd is on a system header.
The prototype for getwd should be removed.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]