Commit e8e71920 e8e71920f6a3c8821427cf9450a8476f6c01411e by Sergey Poznyakoff

Use mu_syslog_error_printer. Fixed misplaced if condition.

1 parent 65c56212
...@@ -86,7 +86,6 @@ int timeout = 0; ...@@ -86,7 +86,6 @@ int timeout = 0;
86 int maxlines = 5; 86 int maxlines = 5;
87 char hostname[MAXHOSTNAMELEN]; 87 char hostname[MAXHOSTNAMELEN];
88 88
89 static int syslog_error_printer (const char *fmt, va_list ap);
90 static void comsat_init (void); 89 static void comsat_init (void);
91 static void comsat_daemon_init (void); 90 static void comsat_daemon_init (void);
92 static void comsat_daemon (int port); 91 static void comsat_daemon (int port);
...@@ -156,7 +155,7 @@ main(int argc, char **argv) ...@@ -156,7 +155,7 @@ main(int argc, char **argv)
156 155
157 /* Set up error messaging */ 156 /* Set up error messaging */
158 openlog ("gnu-comsat", LOG_PID, LOG_LOCAL1); 157 openlog ("gnu-comsat", LOG_PID, LOG_LOCAL1);
159 mu_error_set_print (syslog_error_printer); 158 mu_error_set_print (mu_syslog_error_printer);
160 159
161 if (config_file) 160 if (config_file)
162 read_config (config_file); 161 read_config (config_file);
...@@ -375,7 +374,7 @@ comsat_main (int fd) ...@@ -375,7 +374,7 @@ comsat_main (int fd)
375 374
376 /* Parse the buffer */ 375 /* Parse the buffer */
377 p = strchr (buffer, '@'); 376 p = strchr (buffer, '@');
378 if (!p && !isspace (*p)) 377 if (!p)
379 { 378 {
380 syslog (LOG_ERR, "malformed input: %s", buffer); 379 syslog (LOG_ERR, "malformed input: %s", buffer);
381 return 1; 380 return 1;
...@@ -385,13 +384,13 @@ comsat_main (int fd) ...@@ -385,13 +384,13 @@ comsat_main (int fd)
385 offset = strtoul (p, &endp, 0); 384 offset = strtoul (p, &endp, 0);
386 switch (*endp) 385 switch (*endp)
387 { 386 {
388 case ' ':
389 case 0: 387 case 0:
390 break; 388 break;
391 case ':': 389 case ':':
392 path = endp+1; 390 path = endp+1;
393 break; 391 break;
394 default: 392 default:
393 if (!isspace (*endp))
395 syslog (LOG_ERR, "malformed input: %s@%s (near %s)", buffer, p, endp); 394 syslog (LOG_ERR, "malformed input: %s@%s (near %s)", buffer, p, endp);
396 } 395 }
397 396
...@@ -537,7 +536,7 @@ notify_user (char *user, char *device, char *path, off_t offset) ...@@ -537,7 +536,7 @@ notify_user (char *user, char *device, char *path, off_t offset)
537 /* Take care to clear eighth bit, so we won't upset some stupid terminals */ 536 /* Take care to clear eighth bit, so we won't upset some stupid terminals */
538 #define LB(c) ((c)&0x7f) 537 #define LB(c) ((c)&0x7f)
539 538
540 nlines = maxlines; /*FIXME:configurable*/ 539 nlines = maxlines;
541 if (header_aget_value (header, MU_HEADER_FROM, &p) == 0) 540 if (header_aget_value (header, MU_HEADER_FROM, &p) == 0)
542 { 541 {
543 fprintf (fp, "From: "); 542 fprintf (fp, "From: ");
...@@ -658,13 +657,6 @@ change_user (char *user) ...@@ -658,13 +657,6 @@ change_user (char *user)
658 setuid (pw->pw_uid); 657 setuid (pw->pw_uid);
659 } 658 }
660 659
661 static int
662 syslog_error_printer (const char *fmt, va_list ap)
663 {
664 vsyslog (LOG_CRIT, fmt, ap);
665 return 0;
666 }
667
668 void 660 void
669 help () 661 help ()
670 { 662 {
......