"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/dup2.c" between
le-1.16.5.tar.gz and le-1.16.6.tar.gz

About: le is a terminal text editor (many block operations with stream and rectangular blocks, tunable syntax highlighting, etc.).

dup2.c  (le-1.16.5):dup2.c  (le-1.16.6)
/* Duplicate an open file descriptor to a specified file descriptor. /* Duplicate an open file descriptor to a specified file descriptor.
Copyright (C) 1999, 2004-2007, 2009-2017 Free Software Foundation, Inc. Copyright (C) 1999, 2004-2007, 2009-2019 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* written by Paul Eggert */ /* written by Paul Eggert */
#include <config.h> #include <config.h>
/* Specification. */ /* Specification. */
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#if HAVE_DUP2 #if HAVE_DUP2
# undef dup2 # undef dup2
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ # if defined _WIN32 && ! defined __CYGWIN__
/* Get declarations of the native Windows API functions. */ /* Get declarations of the native Windows API functions. */
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <windows.h> # include <windows.h>
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
# include "msvc-inval.h" # include "msvc-inval.h"
# endif # endif
/* Get _get_osfhandle. */ /* Get _get_osfhandle. */
skipping to change at line 91 skipping to change at line 91
{ {
if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
{ {
errno = EBADF; errno = EBADF;
return -1; return -1;
} }
return fd; return fd;
} }
/* Wine 1.0.1 return 0 when desired_fd is negative but not -1: /* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
http://bugs.winehq.org/show_bug.cgi?id=21289 */ https://bugs.winehq.org/show_bug.cgi?id=21289 */
if (desired_fd < 0) if (desired_fd < 0)
{ {
errno = EBADF; errno = EBADF;
return -1; return -1;
} }
result = dup2_nothrow (fd, desired_fd); result = dup2_nothrow (fd, desired_fd);
if (result == 0) if (result == 0)
result = desired_fd; result = desired_fd;
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)