# HG changeset patch # User Bruno Haible # Date 1538695016 -7200 # Node ID 423dd81f09f4664d980b7d11ebcb5adfba132b67 # Parent 2ea5ba48211bac964ddc3ca2570e07c46dedabd5 fcntl: Make it possible to namespace the defined symbol, part 2. * lib/fcntl.c: Fix syntax errors in last commit. diff -r 2ea5ba48211b -r 423dd81f09f4 lib/fcntl.c --- a/lib/fcntl.c Fri Oct 05 00:27:25 2018 +0200 +++ b/lib/fcntl.c Fri Oct 05 01:16:56 2018 +0200 @@ -460,22 +460,22 @@ /* 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) + result = -1; + else { - int saved_errno = errno; - close (result); - result = -1; - errno = saved_errno; + result = fcntl (fd, F_DUPFD, 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); +# endif } -# if REPLACE_FCHDIR - if (0 <= result) - result = _gl_register_dup (fd, result); -# endif } #else result = fcntl (fd, F_DUPFD, target); @@ -506,7 +506,7 @@ static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0; if (0 <= have_dupfd_cloexec) { - result = fcntl (fd, action, target); + result = fcntl (fd, F_DUPFD_CLOEXEC, target); if (0 <= result || errno != EINVAL) { have_dupfd_cloexec = 1; @@ -518,9 +518,8 @@ else { result = rpl_fcntl_DUPFD (fd, target); - if (result < 0) - break; - have_dupfd_cloexec = -1; + if (result >= 0) + have_dupfd_cloexec = -1; } } else