X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstdio-write.c;h=f7da9e420bf3ac8b6dce83bf92fb82e6a8fc3ee4;hb=32d1664e8e930d8fa6a29db4caac4d21623e42c8;hp=1bd1be29ebfdc0a00f9e516c198d790c1f7ee66d;hpb=9ff044ec4deb16682a04fb608b2576f205da48e3;p=gnulib.git diff --git a/lib/stdio-write.c b/lib/stdio-write.c index 1bd1be29e..f7da9e420 100644 --- a/lib/stdio-write.c +++ b/lib/stdio-write.c @@ -1,5 +1,5 @@ /* POSIX compatible FILE stream write function. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2010 Free Software Foundation, Inc. Written by Bruno Haible , 2008. This program is free software: you can redistribute it and/or modify @@ -39,29 +39,31 @@ # include # define CALL_WITH_SIGPIPE_EMULATION(RETTYPE, EXPRESSION, FAILED) \ - if (ferror (stream)) \ - return (EXPRESSION); \ - else \ - { \ - RETTYPE ret; \ - SetLastError (0); \ - ret = (EXPRESSION); \ + if (ferror (stream)) \ + return (EXPRESSION); \ + else \ + { \ + RETTYPE ret; \ + SetLastError (0); \ + ret = (EXPRESSION); \ if (FAILED && GetLastError () == ERROR_NO_DATA && ferror (stream)) \ - { \ - int fd = fileno (stream); \ - if (fd >= 0 && GetFileType (_get_osfhandle (fd)) == FILE_TYPE_PIPE) \ - { \ - /* Try to raise signal SIGPIPE. */ \ - raise (SIGPIPE); \ - /* If it is currently blocked or ignored, change errno from \ - EINVAL to EPIPE. */ \ - errno = EPIPE; \ - } \ - } \ - return ret; \ + { \ + int fd = fileno (stream); \ + if (fd >= 0 \ + && GetFileType ((HANDLE) _get_osfhandle (fd)) == FILE_TYPE_PIPE)\ + { \ + /* Try to raise signal SIGPIPE. */ \ + raise (SIGPIPE); \ + /* If it is currently blocked or ignored, change errno from \ + EINVAL to EPIPE. */ \ + errno = EPIPE; \ + } \ + } \ + return ret; \ } # if !REPLACE_PRINTF_POSIX /* avoid collision with printf.c */ +# if !DEPENDS_ON_LIBINTL /* avoid collision with intl/printf.c */ int printf (const char *format, ...) { @@ -74,6 +76,7 @@ printf (const char *format, ...) return retval; } +# endif # endif # if !REPLACE_FPRINTF_POSIX /* avoid collision with fprintf.c */ @@ -91,7 +94,7 @@ fprintf (FILE *stream, const char *format, ...) } # endif -# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vprintf.c */ +# if !REPLACE_VPRINTF_POSIX /* avoid collision with vprintf.c */ int vprintf (const char *format, va_list args) { @@ -99,7 +102,7 @@ vprintf (const char *format, va_list args) } # endif -# if !REPLACE_VPRINTF_POSIX /* avoid collision with vfprintf.c */ +# if !REPLACE_VFPRINTF_POSIX /* avoid collision with vfprintf.c */ int vfprintf (FILE *stream, const char *format, va_list args) #undef vfprintf