Re: [PATCH] logsys: Handle full /dev/shm correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Friesse <jfriesse@xxxxxxxxxx> 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?

>  	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?
-- 
Regards,
Feri.
_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux