Use args list only once. Probably better to use an intermediate buffer anyway.
This commit is contained in:
parent
86bc39b65a
commit
8ff25f503a
@ -47,25 +47,29 @@
|
|||||||
|
|
||||||
void vguacd_log_info(const char* format, va_list args) {
|
void vguacd_log_info(const char* format, va_list args) {
|
||||||
|
|
||||||
|
/* Copy log message into buffer */
|
||||||
|
char message[2048];
|
||||||
|
vsnprintf(message, sizeof(message), format, args);
|
||||||
|
|
||||||
/* Log to syslog */
|
/* Log to syslog */
|
||||||
vsyslog(LOG_INFO, format, args);
|
syslog(LOG_INFO, "%s", message);
|
||||||
|
|
||||||
/* Log to STDERR */
|
/* Log to STDERR */
|
||||||
fprintf(stderr, "guacd[%i]: INFO: ", getpid());
|
fprintf(stderr, "guacd[%i]: INFO: %s\n", getpid(), message);
|
||||||
vfprintf(stderr, format, args);
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vguacd_log_error(const char* format, va_list args) {
|
void vguacd_log_error(const char* format, va_list args) {
|
||||||
|
|
||||||
|
/* Copy log message into buffer */
|
||||||
|
char message[2048];
|
||||||
|
vsnprintf(message, sizeof(message), format, args);
|
||||||
|
|
||||||
/* Log to syslog */
|
/* Log to syslog */
|
||||||
vsyslog(LOG_ERR, format, args);
|
syslog(LOG_ERR, "%s", message);
|
||||||
|
|
||||||
/* Log to STDERR */
|
/* Log to STDERR */
|
||||||
fprintf(stderr, "guacd[%i]: ERROR: ", getpid());
|
fprintf(stderr, "guacd[%i]: ERROR: %s\n", getpid(), message);
|
||||||
vfprintf(stderr, format, args);
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user