bug-gnulib
[Top][All Lists]
Advanced

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

Re: snapshot in preparation for 1.4.13


From: Eric Blake
Subject: Re: snapshot in preparation for 1.4.13
Date: Mon, 19 Jan 2009 08:31:49 -0800 (PST)

> Meanwhile, I will be working on a gnulib patch that fixes
> unistd.h to provide STD{IN,OUT,ERR}_FILENO (gnulib has several files that
> do ad-hoc definition of these constants, but we might as well provide it
> for free in our replacement header).

I'm applying this:

>From ae5dae6fd1caa993e969b869e42820a119385cbc Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 19 Jan 2009 09:27:47 -0700
Subject: [PATCH] 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 <address@hidden>
---
 ChangeLog                     |   24 ++++++++++++++++++++++++
 doc/posix-headers/unistd.texi |    6 +++++-
 lib/c-stack.c                 |    6 ++----
 lib/dup-safer.c               |    6 ++----
 lib/execute.c                 |   12 +-----------
 lib/fd-safer.c                |    8 +-------
 lib/fopen-safer.c             |    7 ++-----
 lib/pipe.c                    |   12 +-----------
 lib/tmpfile-safer.c           |    6 +-----
 lib/unistd.in.h               |   13 ++++++++++++-
 modules/unistd-safer          |    1 +
 tests/test-posix_spawn1.c     |   12 +-----------
 tests/test-posix_spawn2.c     |   12 +-----------
 tests/test-posix_spawn3.c     |   12 +-----------
 14 files changed, 55 insertions(+), 82 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 12adb30..22ad726 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
 2009-01-19  Eric Blake  <address@hidden>
 
+       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  <address@hidden>
+
        doc: mention more functions added in cygwin 1.7.0
        * doc/posix-functions/abort.texi (abort): Update wording related
        to cygwin.
diff --git a/doc/posix-headers/unistd.texi b/doc/posix-headers/unistd.texi
index b4336a6..855eefb 100644
--- a/doc/posix-headers/unistd.texi
+++ b/doc/posix-headers/unistd.texi
@@ -10,7 +10,11 @@ Portability problems fixed by Gnulib:
 @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.
address@hidden
+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.
diff --git a/lib/c-stack.c b/lib/c-stack.c
index 023f847..e5e3ab6 100644
--- 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 @@ typedef struct sigaltstack stack_t;
 #endif
 
 #include <unistd.h>
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
 
 #if HAVE_LIBSIGSEGV
 # include <sigsegv.h>
diff --git a/lib/dup-safer.c b/lib/dup-safer.c
index a690851..7d9b2be 100644
--- 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.  */
diff --git a/lib/execute.c b/lib/execute.c
index 231f467..71da46f 100644
--- 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 <address@hidden>, 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
diff --git a/lib/fd-safer.c b/lib/fd-safer.c
index df38c8f..fb99001 100644
--- 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
diff --git a/lib/fopen-safer.c b/lib/fopen-safer.c
index 55991a2..9c79922 100644
--- 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 *
diff --git a/lib/pipe.c b/lib/pipe.c
index 05bd4ec..d842c77 100644
--- 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 <address@hidden>, 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
diff --git a/lib/tmpfile-safer.c b/lib/tmpfile-safer.c
index eec401a..e8d05ae 100644
--- 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,
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 52db71c..d8276b1 100644
--- 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
diff --git a/modules/unistd-safer b/modules/unistd-safer
index 4f167e4..86e23ab 100644
--- a/modules/unistd-safer
+++ b/modules/unistd-safer
@@ -10,6 +10,7 @@ lib/unistd-safer.h
 m4/unistd-safer.m4
 
 Depends-on:
+unistd
 
 configure.ac:
 gl_UNISTD_SAFER
diff --git a/tests/test-posix_spawn1.c b/tests/test-posix_spawn1.c
index 0c30b88..d3951eb 100644
--- 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
diff --git a/tests/test-posix_spawn2.c b/tests/test-posix_spawn2.c
index 826d38b..ca57713 100644
--- 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
diff --git a/tests/test-posix_spawn3.c b/tests/test-posix_spawn3.c
index ec5d468..af71068 100644
--- 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!#$%&'()*+,-;address@hidden|}~.tmp"
 
-- 
1.6.0.4


-- 
View this message in context: 
http://www.nabble.com/Re%3A-snapshot-in-preparation-for-1.4.13-tp21544161p21546509.html
Sent from the Gnulib mailing list archive at Nabble.com.





reply via email to

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