netlink: include file and line in netlink ABI errors
PATCH 1/1 netlink: include file and line in netlink ABI errors
Let's give some more information when netlink ABI errors happens.
Signed-off-by Arturo Borrero Gonzalez <[email protected]>
--- include/netlink.h | 4 +++- src/netlink.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-)
include/netlink.h +3 -1
@@ -139,7 +139,9 @@ extern void netlink_dump_set(struct nft_set *nls);extern int netlink_batch_send (struct list_head *err_list);extern void netlink_restart (void ); -extern void netlink_abi_error (void )__noreturn ; +#define netlink_abi_error () \ + __netlink_abi_error(__FILE__, __LINE__, strerror(errno)); +extern void __noreturn __netlink_abi_error (const char *file,int line,const char *reason);extern int netlink_io_error (struct netlink_ctx *ctx,const struct location *loc,const char *fmt, ...);extern void netlink_open_error (void )__noreturn ;
src/netlink.c +3 -2
@@ -80,10 +80,11 @@ static void netlink_open_mon_sock(void) nf_mon_sock =nfsock_open (); } -void __noreturn netlink_abi_error (void ) +void __noreturn __netlink_abi_error (const char *file,int line, +const char *reason) {fprintf (stderr,"E: Contact urgently your Linux kernel vendor. " -"Netlink ABI is broken: %s\n" ,strerror (errno)); +"Netlink ABI is broken: %s:%d %s\n" , file, line, reason);exit (NFT_EXIT_FAILURE ); }
Quoted 1 line · Arturo Borrero Gonzalez
Let's give some more information when netlink ABI errors happens.
Applied, thanks.