DevHeads.net

Recommendation for updating msg_panic() to msg_warn() in certain circumstances

Our team researches on consistent update of Postfix during evolution. And we have figured out several spots that may be missed. 

By mining historical patches, we suggest that msg_panic() should be updated to msg_warn()for the logging statement which is under the control dependence where return value of dict_handle()is 0. One example for recommendation and corresponding patch are listed as follows. 

One example of missed spot:
1 const char *maps_find(MAPS *maps, const char *name, int flags)
2 {
....
20 for (map_name = maps->argv->argv; *map_name; map_name++) {
21 if ((dict = dict_handle(*map_name)) == 0)
22 msg_panic("%s: dictionary not found: %s", myname, *map_name);
....
}

One example of historical patch:
1 #define FOUND1
2 #define MISSED0
3
4 if (msg_verbose)
5 msg_info("%s: %s", myname, name);
6
7 - if ((dict = dict_handle(table)) == 0)
8 - msg_panic("%s: dictionary not found: %s", myname, table);
9 + if ((dict = dict_handle(table)) == 0) {
10 + msg_warn("%s: unexpected dictionary: %s", myname, table);
11 + value = "451 4.3.5 Server configuration error";
12 + CHK_ACCESS_RETURN(check_table_result(state, table, value,
name,
13 + reply_name, reply_class,
14 + def_acl), FOUND);
15 + }

More recommendations and supporting patches are saved in attachments. It is so kind of you to reply me about the correctness of our suggestions. And thank you for your reading.