[28022] in CVS-changelog-for-Kerberos-V5
krb5 commit: Make set_cloexec_fd return void
daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Mon Nov 4 14:22:38 2013
Date: Mon, 4 Nov 2013 14:22:24 -0500
From: Benjamin Kaduk <kaduk@mit.edu>
Message-Id: <201311041922.rA4JMOZO011879@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu
https://github.com/krb5/krb5/commit/4547a1078afdeeb781307cf4a125baccf2edab02
commit 4547a1078afdeeb781307cf4a125baccf2edab02
Author: Ben Kaduk <kaduk@mit.edu>
Date: Wed Oct 30 14:11:40 2013 -0400
Make set_cloexec_fd return void
We never check its return value (causing clang to emit warnings),
and its use is primarily in cases where we should continue processing
in the event of failure. Just ignore errors from the underlying
fcntl() call (if present) and treat this operation as best-effort.
The #if 0 code should probably be removed.
src/include/k5-platform.h | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 7203a99..8f0ca9f 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -874,22 +874,19 @@ k5_ntohll (UINT64_TYPE val)
anyways. */
#if 0
-static inline int
+static inline void
set_cloexec_fd(int fd)
{
#if defined(F_SETFD)
# ifdef FD_CLOEXEC
- if (fcntl(fd, F_SETFD, FD_CLOEXEC) != 0)
- return errno;
+ (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
# else
- if (fcntl(fd, F_SETFD, 1) != 0)
- return errno;
+ (void)fcntl(fd, F_SETFD, 1);
# endif
#endif
- return 0;
}
-static inline int
+static inline void
set_cloexec_file(FILE *f)
{
return set_cloexec_fd(fileno(f));
@@ -901,12 +898,12 @@ set_cloexec_file(FILE *f)
with F_SETFD. */
#ifdef F_SETFD
# ifdef FD_CLOEXEC
-# define set_cloexec_fd(FD) (fcntl((FD), F_SETFD, FD_CLOEXEC) ? errno : 0)
+# define set_cloexec_fd(FD) ((void)fcntl((FD), F_SETFD, FD_CLOEXEC))
# else
-# define set_cloexec_fd(FD) (fcntl((FD), F_SETFD, 1) ? errno : 0)
+# define set_cloexec_fd(FD) ((void)fcntl((FD), F_SETFD, 1))
# endif
#else
-# define set_cloexec_fd(FD) ((FD),0)
+# define set_cloexec_fd(FD) ((void)(FD))
#endif
#define set_cloexec_file(F) set_cloexec_fd(fileno(F))
#endif
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5