[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] End truncated log entries with [truncated]
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv20516/src/common
Modified Files:
log.c
Log Message:
End truncated log entries with [truncated]
Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- log.c 12 Jul 2004 16:51:28 -0000 1.47
+++ log.c 15 Aug 2004 20:13:07 -0000 1.48
@@ -22,6 +22,9 @@
#define snprintf _snprintf
#endif
+#define TRUNCATED_STR "\n[truncated]"
+#define TRUNCATED_STR_LEN 12
+
/** Information for a single logfile; only used in log.c */
typedef struct logfile_t {
struct logfile_t *next; /**< Next logfile_t in the linked list. */
@@ -116,8 +119,10 @@
}
n += vsnprintf(buf+n,buf_len-n,format,ap);
- if(n > buf_len)
+ if(n > buf_len) {
n = buf_len-1;
+ strcpy(buf+n-TRUNCATED_STR_LEN, TRUNCATED_STR);
+ }
buf[n]='\n';
buf[n+1]='\0';
}