Added LOG_STR_LEN define to avoid hardcoded length for log strings

This commit is contained in:
Aurelien Foret 2005-03-16 19:50:57 +00:00
parent fac045a958
commit c583f03886
3 changed files with 6 additions and 4 deletions

View File

@ -529,11 +529,11 @@ int alpm_trans_release()
int alpm_logaction(char *fmt, ...)
{
char str[256];
char str[LOG_STR_LEN];
va_list args;
va_start(args, fmt);
vsnprintf(str, 256, fmt, args);
vsnprintf(str, LOG_STR_LEN, fmt, args);
va_end(args);
return(_alpm_log_action(handle->usesyslog, handle->logfd, str));

View File

@ -33,7 +33,7 @@ unsigned char __pm_logmask = 0;
void _alpm_log(unsigned char flag, char *fmt, ...)
{
char str[256];
char str[LOG_STR_LEN];
va_list args;
if(__pm_logcb == NULL) {
@ -42,7 +42,7 @@ void _alpm_log(unsigned char flag, char *fmt, ...)
if(flag & __pm_logmask) {
va_start(args, fmt);
vsnprintf(str, 256, fmt, args);
vsnprintf(str, LOG_STR_LEN, fmt, args);
va_end(args);
__pm_logcb(flag, str);

View File

@ -21,6 +21,8 @@
#ifndef _ALPM_LOG_H
#define _ALPM_LOG_H
#define LOG_STR_LEN 256
typedef void (*alpm_cb_log)(unsigned short, char *);
void _alpm_log(unsigned char flag, char *fmt, ...);