+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
@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.
/* 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
#endif
#include <unistd.h>
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
#if HAVE_LIBSIGSEGV
# include <sigsegv.h>
/* 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
#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. */
/* 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
#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
/* 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
#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
/* 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
#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 *
/* 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
#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
/* 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
#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,
#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
/* 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
m4/unistd-safer.m4
Depends-on:
+unistd
configure.ac:
gl_UNISTD_SAFER
/* 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
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
/* 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
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
/* 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
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"