X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=gnu%2Ffcntl.c;h=febc21363a651e47ef9ea0c99c208304ebfd35c5;hb=1a44d77d50f4fb37c0410eed04b82303624ea2ec;hp=3f4af8a2ae8bb26836a63cfa26e1966264df6919;hpb=dda6367c9eac71da8f2ab1c60b3df60f19ce4755;p=debian%2Ftar diff --git a/gnu/fcntl.c b/gnu/fcntl.c index 3f4af8a2..febc2136 100644 --- a/gnu/fcntl.c +++ b/gnu/fcntl.c @@ -2,7 +2,7 @@ /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ /* Provide file descriptor control. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 @@ -189,7 +189,21 @@ rpl_fcntl (int fd, int action, /* arg */...) 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); + 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);