aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2013-03-12 17:38:42 -0700
committerPaul Eggert2013-03-12 17:38:42 -0700
commit5615c9a9af487c19ab0bd30cb15d7bdb9af53560 (patch)
treeda5460962adeb04d0b5589f388a52a129095a41b
parent84c3ab6860d2247e0da13d418545807a5f2f90fc (diff)
downloademacs-5615c9a9af487c19ab0bd30cb15d7bdb9af53560.tar.gz
emacs-5615c9a9af487c19ab0bd30cb15d7bdb9af53560.zip
Merge from gnulib.
This incorporates: 2013-03-12 mktime: fix configure typo 2013-03-11 regex: port to mingw's recent addition of undeclared alarm 2013-03-11 putenv: avoid compilation warning on mingw 2013-03-11 unistd: don't prevent Tru64 Unix from using gnulib strtod.
-rw-r--r--ChangeLog8
-rw-r--r--lib/putenv.c76
-rw-r--r--lib/unistd.in.h4
-rw-r--r--m4/mktime.m411
4 files changed, 57 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 84d88fa7f1a..1dfbeae4c56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
12013-03-13 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, incorporating:
4 2013-03-12 mktime: fix configure typo
5 2013-03-11 regex: port to mingw's recent addition of undeclared alarm
6 2013-03-11 putenv: avoid compilation warning on mingw
7 2013-03-11 unistd: don't prevent Tru64 Unix from using gnulib strtod.
8
12013-03-06 Paul Eggert <eggert@cs.ucla.edu> 92013-03-06 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 * configure.ac (TERM_HEADER): Remove duplicate definition (Bug#13872). 11 * configure.ac (TERM_HEADER): Remove duplicate definition (Bug#13872).
diff --git a/lib/putenv.c b/lib/putenv.c
index ed666afc3bb..3813a11ece7 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -62,7 +62,9 @@ static int
62_unsetenv (const char *name) 62_unsetenv (const char *name)
63{ 63{
64 size_t len; 64 size_t len;
65#if !HAVE__PUTENV
65 char **ep; 66 char **ep;
67#endif
66 68
67 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL) 69 if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
68 { 70 {
@@ -126,45 +128,45 @@ putenv (char *string)
126 } 128 }
127 129
128#if HAVE__PUTENV 130#if HAVE__PUTENV
129 /* Rely on _putenv to allocate the new environment. If other 131 /* Rely on _putenv to allocate the new environment. If other
130 parts of the application use _putenv, the !HAVE__PUTENV code 132 parts of the application use _putenv, the !HAVE__PUTENV code
131 would fight over who owns the environ vector, causing a crash. */ 133 would fight over who owns the environ vector, causing a crash. */
132 if (name_end[1]) 134 if (name_end[1])
133 return _putenv (string); 135 return _putenv (string);
134 else 136 else
135 { 137 {
136 /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ") 138 /* _putenv ("NAME=") unsets NAME, so invoke _putenv ("NAME= ")
137 to allocate the environ vector and then replace the new 139 to allocate the environ vector and then replace the new
138 entry with "NAME=". */ 140 entry with "NAME=". */
139 int putenv_result, putenv_errno; 141 int putenv_result, putenv_errno;
140 char *name_x = malloc (name_end - string + sizeof "= "); 142 char *name_x = malloc (name_end - string + sizeof "= ");
141 if (!name_x) 143 if (!name_x)
142 return -1; 144 return -1;
143 memcpy (name_x, string, name_end - string + 1); 145 memcpy (name_x, string, name_end - string + 1);
144 name_x[name_end - string + 1] = ' '; 146 name_x[name_end - string + 1] = ' ';
145 name_x[name_end - string + 2] = 0; 147 name_x[name_end - string + 2] = 0;
146 putenv_result = _putenv (name_x); 148 putenv_result = _putenv (name_x);
147 putenv_errno = errno; 149 putenv_errno = errno;
148 for (ep = environ; *ep; ep++) 150 for (ep = environ; *ep; ep++)
149 if (strcmp (*ep, name_x) == 0) 151 if (strcmp (*ep, name_x) == 0)
150 { 152 {
151 *ep = string; 153 *ep = string;
152 break; 154 break;
153 } 155 }
154# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ 156# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
155 if (putenv_result == 0) 157 if (putenv_result == 0)
156 { 158 {
157 /* _putenv propagated "NAME= " into the subprocess environment; 159 /* _putenv propagated "NAME= " into the subprocess environment;
158 fix that by calling SetEnvironmentVariable directly. */ 160 fix that by calling SetEnvironmentVariable directly. */
159 name_x[name_end - string] = 0; 161 name_x[name_end - string] = 0;
160 putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1; 162 putenv_result = SetEnvironmentVariable (name_x, "") ? 0 : -1;
161 putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */ 163 putenv_errno = ENOMEM; /* ENOMEM is the only way to fail. */
162 }
163# endif
164 free (name_x);
165 __set_errno (putenv_errno);
166 return putenv_result;
167 } 164 }
165# endif
166 free (name_x);
167 __set_errno (putenv_errno);
168 return putenv_result;
169 }
168#else 170#else
169 for (ep = environ; *ep; ep++) 171 for (ep = environ; *ep; ep++)
170 if (strncmp (*ep, string, name_end - string) == 0 172 if (strncmp (*ep, string, name_end - string) == 0
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 675c7e6a552..2ea9af43652 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -61,8 +61,10 @@
61/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in 61/* mingw, MSVC, BeOS, Haiku declare environ in <stdlib.h>, not in
62 <unistd.h>. */ 62 <unistd.h>. */
63/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */ 63/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>. */
64/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system <stdlib.h> is
65 included here. */
64/* But avoid namespace pollution on glibc systems. */ 66/* But avoid namespace pollution on glibc systems. */
65#ifndef __GLIBC__ 67#if !defined __GLIBC__ && !defined __osf__
66# define __need_system_stdlib_h 68# define __need_system_stdlib_h
67# include <stdlib.h> 69# include <stdlib.h>
68# undef __need_system_stdlib_h 70# undef __need_system_stdlib_h
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index d3d376a4e2c..faefb770092 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
1# serial 24 1# serial 25
2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation, 2dnl Copyright (C) 2002-2003, 2005-2007, 2009-2013 Free Software Foundation,
3dnl Inc. 3dnl Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
@@ -14,7 +14,7 @@ AC_DEFUN([gl_FUNC_MKTIME],
14 dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained 14 dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained
15 dnl in Autoconf and because it invokes AC_LIBOBJ. 15 dnl in Autoconf and because it invokes AC_LIBOBJ.
16 AC_CHECK_HEADERS_ONCE([unistd.h]) 16 AC_CHECK_HEADERS_ONCE([unistd.h])
17 AC_CHECK_FUNCS_ONCE([alarm]) 17 AC_CHECK_DECLS_ONCE([alarm])
18 AC_REQUIRE([gl_MULTIARCH]) 18 AC_REQUIRE([gl_MULTIARCH])
19 if test $APPLE_UNIVERSAL_BUILD = 1; then 19 if test $APPLE_UNIVERSAL_BUILD = 1; then
20 # A universal build on Apple Mac OS X platforms. 20 # A universal build on Apple Mac OS X platforms.
@@ -34,8 +34,8 @@ AC_DEFUN([gl_FUNC_MKTIME],
34# include <unistd.h> 34# include <unistd.h>
35#endif 35#endif
36 36
37#ifndef HAVE_ALARM 37#if HAVE_DECL_ALARM
38# define alarm(X) /* empty */ 38# include <signal.h>
39#endif 39#endif
40 40
41/* Work around redefinition to rpl_putenv by other config tests. */ 41/* Work around redefinition to rpl_putenv by other config tests. */
@@ -171,10 +171,13 @@ main ()
171 int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1; 171 int time_t_signed_magnitude = (time_t) ~ (time_t) 0 < (time_t) -1;
172 int time_t_signed = ! ((time_t) 0 < (time_t) -1); 172 int time_t_signed = ! ((time_t) 0 < (time_t) -1);
173 173
174#if HAVE_DECL_ALARM
174 /* This test makes some buggy mktime implementations loop. 175 /* This test makes some buggy mktime implementations loop.
175 Give up after 60 seconds; a mktime slower than that 176 Give up after 60 seconds; a mktime slower than that
176 isn't worth using anyway. */ 177 isn't worth using anyway. */
178 signal (SIGALRM, SIG_DFL);
177 alarm (60); 179 alarm (60);
180#endif
178 181
179 time_t_max = (! time_t_signed 182 time_t_max = (! time_t_signed
180 ? (time_t) -1 183 ? (time_t) -1