Update of /cvsroot/synce/serial/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26522
Modified Files:
synce-serial-chat.c
Log Message:
Log errors to syslog
Index: synce-serial-chat.c
===================================================================
RCS file: /cvsroot/synce/serial/src/synce-serial-chat.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- synce-serial-chat.c 20 Nov 2002 08:39:19 -0000 1.1
+++ synce-serial-chat.c 23 Jul 2003 13:12:18 -0000 1.2
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <syslog.h>
#define CLIENT_SIZE 6
#define CLIENTSERVER_SIZE (CLIENT_SIZE + 6)
@@ -22,6 +23,8 @@
argv[0], client, clientserver);
return 1;
}
+
+ openlog("synce-serial-chat", 0, LOG_DAEMON);
memset(buffer, 0, sizeof(buffer));
@@ -40,19 +43,20 @@
if (bytes_left != 0)
{
- fprintf(stderr, "Unable to read %i bytes\n", CLIENT_SIZE);
+ syslog(LOG_INFO, "Failed to read last %i bytes. Only %i bytes read: '%s'",
+ bytes_left, bytes_read_total, buffer);
return 1;
}
if (memcmp(buffer, client, CLIENT_SIZE) != 0)
{
- fprintf(stderr, "Received string not 'CLIENT' but '%s'\n", buffer);
+ syslog(LOG_INFO, "Received string not 'CLIENT' but '%s'", buffer);
return 1;
}
if (write(STDOUT_FILENO, clientserver, CLIENTSERVER_SIZE) != CLIENTSERVER_SIZE)
{
- fprintf(stderr, "Unable to write '%s'\n", clientserver);
+ syslog(LOG_INFO, "Unable to write '%s'", clientserver);
return 1;
}
|