Ferenc,
Ferenc Wagner napsal(a):
> Jan Friesse <[email protected]> writes:
>
>> --- a/include/corosync/engine/logsys.h
>> +++ b/include/corosync/engine/logsys.h
>> @@ -342,29 +342,41 @@ extern void *logsys_rec_end;
>> __attribute__ ((constructor))
>> \
>> static void logsys_system_init (void)
>> \
>> { \
>> + const char *error_str; \
>> + \
>> if (_logsys_system_setup (name,mode,debug,file,file_priority, \
>> syslog_facility,syslog_priority) < 0) { \
>> fprintf (stderr, \
>> "Unable to setup logging system: %s.\n", name); \
>> - exit (-1); \
>> + syslog (LOG_ERR, \
>> + "Unable to setup logging system: %s.\n", name); \
>> + exit (EXIT_FAILURE); \
>> } \
>
> I have no idea about the corosync codebase.
> But why don't you use error_str here just like below?
gcc warning
>
>> if (logsys_format_set (format) == -1) { \
>> - fprintf (stderr, \
>> - "Unable to setup logging format.\n"); \
>> - exit (-1); \
>> + error_str = "Unable to setup logging format."; \
>> + \
>> + fprintf (stderr, "%s\n", error_str); \
>> + syslog (LOG_ERR, "%s\n", error_str); \
>> + exit (EXIT_FAILURE); \
>> } \
>
> Is defensive coding the reason for "%s\n" instead of simply using
> error_str as a nullary template?
yes + gcc warning.
>
Regards,
Honza
_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss