Mercurial > hg > octave-shane > gnulib-hg
changeset 11049:8398d9f607b4
unistd: guarantee STDIN_FILENO here, for OS/2 EMX
* lib/unistd.in.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Guarantee a definition.
* doc/posix-headers/unistd.texi (unistd.h): Document the bug.
* modules/unistd-safer (Depends-on): Add dependency on unistd.
* lib/c-stack.c (STDERR_FILENO): Rely on <unistd.h>.
* lib/dup-safer.c (STDERR_FILENO): Likewise.
* lib/execute.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Likewise.
* lib/fd-safer.c (STDIN_FILENO, STDERR_FILENO): Likewise.
* lib/fopen-safer.c (STDERR_FILENO): Likewise.
* lib/pipe.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO):
Likewise.
* lib/tmpfile-safer.c (STDERR_FILENO): Likewise.
* tests/test-posix_spawn1.c (STDIN_FILENO, STDOUT_FILENO)
(STDERR_FILENO): Likewise.
* tests/test-posix_spawn2.c (STDIN_FILENO, STDOUT_FILENO)
(STDERR_FILENO): Likewise.
* tests/test-posix_spawn3.c (STDIN_FILENO, STDOUT_FILENO)
(STDERR_FILENO): Likewise.
Reported by Elbert Pol.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 19 Jan 2009 09:27:47 -0700 |
parents | b885f8c983db |
children | c6c15724d887 |
files | ChangeLog doc/posix-headers/unistd.texi lib/c-stack.c lib/dup-safer.c lib/execute.c lib/fd-safer.c lib/fopen-safer.c lib/pipe.c lib/tmpfile-safer.c lib/unistd.in.h modules/unistd-safer tests/test-posix_spawn1.c tests/test-posix_spawn2.c tests/test-posix_spawn3.c |
diffstat | 14 files changed, 55 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2009-01-19 Eric Blake <ebb9@byu.net> + + unistd: guarantee STDIN_FILENO here, for OS/2 EMX + * lib/unistd.in.h (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): + Guarantee a definition. + * doc/posix-headers/unistd.texi (unistd.h): Document the bug. + * modules/unistd-safer (Depends-on): Add dependency on unistd. + * lib/c-stack.c (STDERR_FILENO): Rely on <unistd.h>. + * lib/dup-safer.c (STDERR_FILENO): Likewise. + * lib/execute.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): + Likewise. + * lib/fd-safer.c (STDIN_FILENO, STDERR_FILENO): Likewise. + * lib/fopen-safer.c (STDERR_FILENO): Likewise. + * lib/pipe.c (STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): + Likewise. + * lib/tmpfile-safer.c (STDERR_FILENO): Likewise. + * tests/test-posix_spawn1.c (STDIN_FILENO, STDOUT_FILENO) + (STDERR_FILENO): Likewise. + * tests/test-posix_spawn2.c (STDIN_FILENO, STDOUT_FILENO) + (STDERR_FILENO): Likewise. + * tests/test-posix_spawn3.c (STDIN_FILENO, STDOUT_FILENO) + (STDERR_FILENO): Likewise. + Reported by Elbert Pol. + 2009-01-19 Eric Blake <ebb9@byu.net> doc: mention more functions added in cygwin 1.7.0
--- a/doc/posix-headers/unistd.texi +++ b/doc/posix-headers/unistd.texi @@ -10,7 +10,11 @@ @item This header file is missing on some platforms: msvc. @item -The SEEK_* macros are not defined in this file on some platforms: mingw. +The SEEK_* macros are not defined in this file on some platforms: +mingw. +@item +The *_FILENO macros are not defined in this file on some platforms: +OS/2 EMX, mingw. @item The @code{_exit} function is not declared in this file on some platforms: mingw.
--- a/lib/c-stack.c +++ b/lib/c-stack.c @@ -1,6 +1,7 @@ /* Stack overflow handling. - Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008, 2009 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,9 +68,6 @@ #endif #include <unistd.h> -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif #if HAVE_LIBSIGSEGV # include <sigsegv.h>
--- a/lib/dup-safer.c +++ b/lib/dup-safer.c @@ -1,6 +1,7 @@ /* Invoke dup, but avoid some glitches. - Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2004, 2005, 2006, 2009 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,9 +25,6 @@ #include <fcntl.h> #include <unistd.h> -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */
--- a/lib/execute.c +++ b/lib/execute.c @@ -1,5 +1,5 @@ /* Creation of autonomous subprocesses. - Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -54,16 +54,6 @@ #endif -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - /* The results of open() in this file are not used with fchdir, therefore save some unnecessary work in fchdir.c. */ #undef open
--- a/lib/fd-safer.c +++ b/lib/fd-safer.c @@ -1,6 +1,6 @@ /* Return a safer copy of a file descriptor. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,12 +24,6 @@ #include <errno.h> #include <unistd.h> -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif /* Return FD, unless FD would be a copy of standard input, output, or error; in that case, return a duplicate of FD, closing FD. On
--- a/lib/fopen-safer.c +++ b/lib/fopen-safer.c @@ -1,6 +1,7 @@ /* Invoke fopen, but avoid some glitches. - Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2004, 2005, 2006, 2009 Free Software + Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,10 +26,6 @@ #include <unistd.h> #include "unistd-safer.h" -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - /* Like fopen, but do not return stdin, stdout, or stderr. */ FILE *
--- a/lib/pipe.c +++ b/lib/pipe.c @@ -1,5 +1,5 @@ /* Creation of subprocesses, communicating via pipes. - Copyright (C) 2001-2004, 2006-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc. Written by Bruno Haible <haible@clisp.cons.org>, 2001. This program is free software: you can redistribute it and/or modify @@ -54,16 +54,6 @@ #endif -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - /* The results of open() in this file are not used with fchdir, therefore save some unnecessary work in fchdir.c. */ #undef open
--- a/lib/tmpfile-safer.c +++ b/lib/tmpfile-safer.c @@ -1,5 +1,5 @@ /* Invoke tmpfile, but avoid some glitches. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,10 +26,6 @@ #include "binary-io.h" -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - /* Like tmpfile, but do not return stdin, stdout, or stderr. Remember that tmpfile can leave files behind if your program calls _exit,
--- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -29,7 +29,7 @@ #ifndef _GL_UNISTD_H #define _GL_UNISTD_H -/* mingw doesn't define the SEEK_* macros in <unistd.h>. */ +/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) # include <stdio.h> #endif @@ -87,6 +87,17 @@ /* The definition of GL_LINK_WARNING is copied here. */ +/* OS/2 EMX lacks these macros. */ +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + /* Declare overridden functions. */ #ifdef __cplusplus
--- a/modules/unistd-safer +++ b/modules/unistd-safer @@ -10,6 +10,7 @@ m4/unistd-safer.m4 Depends-on: +unistd configure.ac: gl_UNISTD_SAFER
--- a/tests/test-posix_spawn1.c +++ b/tests/test-posix_spawn1.c @@ -1,5 +1,5 @@ /* Test of posix_spawn() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,16 +33,6 @@ extern char **environ; -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - #define CHILD_PROGRAM_FILENAME "test-posix_spawn1.sh" static int
--- a/tests/test-posix_spawn2.c +++ b/tests/test-posix_spawn2.c @@ -1,5 +1,5 @@ /* Test of posix_spawn() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,16 +33,6 @@ extern char **environ; -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - #define CHILD_PROGRAM_FILENAME "test-posix_spawn2.sh" static int
--- a/tests/test-posix_spawn3.c +++ b/tests/test-posix_spawn3.c @@ -1,5 +1,5 @@ /* Test of posix_spawn() function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,16 +35,6 @@ extern char **environ; -#ifndef STDIN_FILENO -# define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -# define STDOUT_FILENO 1 -#endif -#ifndef STDERR_FILENO -# define STDERR_FILENO 2 -#endif - #define CHILD_PROGRAM_FILENAME "test-posix_spawn3" #define DATA_FILENAME "t!#$%&'()*+,-;=?@[\\]^_`{|}~.tmp"