From 414caf80a2705c5953af03db736a0d9774fab9fc Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 May 2000 07:17:34 +0000 Subject: make prs_dump() store up to 100 variants of each msg type (This used to be commit 0e7819bb4562a840ecb9b7ef12706572b6b60202) --- source3/rpc_parse/parse_prs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 2edd080a0e..efcd16470a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -29,13 +29,20 @@ extern int DEBUGLEVEL; /******************************************************************* dump a prs to a file ********************************************************************/ -void prs_dump(char *name, int level, prs_struct *ps) +void prs_dump(char *name, int v, prs_struct *ps) { - int fd; + int fd, i; pstring fname; if (DEBUGLEVEL < 50) return; - slprintf(fname,sizeof(fname), "/tmp/%s_%d.prs", name, level); - fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + for (i=1;i<100;i++) { + if (v != -1) { + slprintf(fname,sizeof(fname), "/tmp/%s_%d.%d.prs", name, v, i); + } else { + slprintf(fname,sizeof(fname), "/tmp/%s.%d.prs", name, i); + } + fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644); + if (fd != -1 || errno != EEXIST) break; + } if (fd != -1) { write(fd, ps->data_p + ps->data_offset, ps->buffer_size - ps->data_offset); close(fd); -- cgit