diff options
author | Eric Blake <ebb9@byu.net> | 2006-07-27 04:34:16 +0000 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2006-07-27 04:34:16 +0000 |
commit | 8f4714e0c552bfc884ebfaa6317a010bf3101e9d (patch) | |
tree | 25b4fb589469afdabb6f66c86ebe36e02c9c926d /lib/pipe-safer.c | |
parent | 6a8de3ffc58390ab0c0fcc88bd99f4e3354bb32c (diff) | |
download | gnulib-8f4714e0c552bfc884ebfaa6317a010bf3101e9d.tar.gz |
* mkstemp-safer.c [! HAVE_MKSTEMP]: Add prototype for platforms
like mingw that lack mkstemp.
* pipe-safer.c (pipe_safer) [!HAVE_FUNC_PIPE]: Provide fallback to
avoid compilation warning on mingw.
Diffstat (limited to 'lib/pipe-safer.c')
-rw-r--r-- | lib/pipe-safer.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/pipe-safer.c b/lib/pipe-safer.c index fb02d72177..646cd5dabb 100644 --- a/lib/pipe-safer.c +++ b/lib/pipe-safer.c @@ -1,5 +1,5 @@ /* Invoke pipe, but avoid some glitches. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 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,13 +24,16 @@ #include "unistd-safer.h" #include <unistd.h> +#include <errno.h> /* Like pipe, but ensure that neither of the file descriptors is - STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. */ + STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO. Fail with ENOSYS on + platforms that lack pipe. */ int pipe_safer (int fd[2]) { +#if HAVE_FUNC_PIPE int fail = pipe (fd); if (fail) return fail; @@ -47,4 +50,8 @@ pipe_safer (int fd[2]) } return 0; +#else /* ! HAVE_FUNC_PIPE */ + errno = ENOSYS; + return -1; +#endif } |