Log warning() at SUDO_DEBUG_WARN not SUDO_DEBUG_ERROR.

Log the function, file and line number in the debug log for warning()
and error().
This commit is contained in:
Todd C. Miller
2012-04-05 12:37:15 -04:00
parent 2fe41248ac
commit 2c84bd4d08
6 changed files with 181 additions and 112 deletions

View File

@@ -38,36 +38,44 @@
#else /* SUDO_ERROR_WRAP */
# if defined(__GNUC__) && __GNUC__ == 2
# define error(rval, fmt...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, (fmt));\
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, (fmt)); \
error2((rval), (fmt)); \
} while (0)
# define errorx(rval, fmt...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|sudo_debug_subsys, (fmt)); \
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|sudo_debug_subsys, (fmt)); \
errorx2((rval), (fmt)); \
} while (0)
# define warning(fmt...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, (fmt));\
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, (fmt)); \
warning2((fmt)); \
} while (0)
# define warningx(fmt...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|sudo_debug_subsys, (fmt)); \
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|sudo_debug_subsys, (fmt)); \
warningx2((fmt)); \
} while (0)
# else
# define error(rval, ...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, __VA_ARGS__);\
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, __VA_ARGS__); \
error2((rval), __VA_ARGS__); \
} while (0)
# define errorx(rval, ...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|sudo_debug_subsys, __VA_ARGS__); \
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_ERROR|sudo_debug_subsys, __VA_ARGS__); \
errorx2((rval), __VA_ARGS__); \
} while (0)
# define warning(...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|sudo_debug_subsys, __VA_ARGS__);\
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_WARN|SUDO_DEBUG_ERRNO|sudo_debug_subsys, __VA_ARGS__); \
warning2(__VA_ARGS__); \
} while (0)
# define warningx(...) do { \
sudo_debug_printf2(SUDO_DEBUG_ERROR|sudo_debug_subsys, __VA_ARGS__); \
sudo_debug_printf2(__func__, __FILE__, __LINE__, \
SUDO_DEBUG_WARN|sudo_debug_subsys, __VA_ARGS__); \
warningx2(__VA_ARGS__); \
} while (0)
# endif /* __GNUC__ == 2 */