dovecot-2.2: lib: Added fd=-1 assert to i_close_fd() macro.

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 11 09:11:36 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/94cdc5bcb308
changeset: 17624:94cdc5bcb308
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 11 12:10:02 2014 +0300
description:
lib: Added fd=-1 assert to i_close_fd() macro.
This way we'll see clearly where it fails, instead of just seeing assert in
close_keep_errno() without an easy way to see where it crashed.

diffstat:

 src/lib/macros.h |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 410f263e6fc3 -r 94cdc5bcb308 src/lib/macros.h
--- a/src/lib/macros.h	Fri Jul 11 11:14:41 2014 +0300
+++ b/src/lib/macros.h	Fri Jul 11 12:10:02 2014 +0300
@@ -205,6 +205,7 @@
 #endif
 
 #define i_close_fd(fd) STMT_START {  \
+	i_assert(*fd != -1); \
 	if (unlikely(close_keep_errno(fd) < 0)) \
 		i_error("close(%d[%s:%d]) failed: %m", \
 			*(fd), __FILE__, __LINE__); \


More information about the dovecot-cvs mailing list