projects
/
debian
/
tar
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'dfsg-orig' into dfsg-debian
[debian/tar]
/
gnu
/
fcntl.c
diff --git
a/gnu/fcntl.c
b/gnu/fcntl.c
index 3f4af8a2ae8bb26836a63cfa26e1966264df6919..02f0ddba5c55538751b7a3f3891653f27567f790 100644
(file)
--- a/
gnu/fcntl.c
+++ b/
gnu/fcntl.c
@@
-2,7
+2,7
@@
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Provide file descriptor control.
/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Provide file descriptor control.
- Copyright (C) 2009
, 2010
Free Software Foundation, Inc.
+ Copyright (C) 2009
-2013
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
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,10
+35,13
@@
#undef fcntl
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
#undef fcntl
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* Get declarations of the
Win32
API functions. */
+/* Get declarations of the
native Windows
API functions. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
+/* Get _get_osfhandle. */
+# include "msvc-nothrow.h"
+
/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */
# define OPEN_MAX_MAX 0x10000
/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */
# define OPEN_MAX_MAX 0x10000
@@
-93,7
+96,7
@@
dupfd (int oldfd, int newfd, int flags)
result = -1;
break;
}
result = -1;
break;
}
- duplicated_fd = _open_osfhandle ((
long
) new_handle, flags);
+ duplicated_fd = _open_osfhandle ((
intptr_t
) new_handle, flags);
if (duplicated_fd < 0)
{
CloseHandle (new_handle);
if (duplicated_fd < 0)
{
CloseHandle (new_handle);
@@
-189,7
+192,21
@@
rpl_fcntl (int fd, int action, /* arg */...)
errno = EINVAL;
else
{
errno = EINVAL;
else
{
+ /* Haiku alpha 2 loses fd flags on original. */
+ int flags = fcntl (fd, F_GETFD);
+ if (flags < 0)
+ {
+ result = -1;
+ break;
+ }
result = fcntl (fd, action, target);
result = fcntl (fd, action, target);
+ if (0 <= result && fcntl (fd, F_SETFD, flags) == -1)
+ {
+ int saved_errno = errno;
+ close (result);
+ result = -1;
+ errno = saved_errno;
+ }
# if REPLACE_FCHDIR
if (0 <= result)
result = _gl_register_dup (fd, result);
# if REPLACE_FCHDIR
if (0 <= result)
result = _gl_register_dup (fd, result);