diff options
Diffstat (limited to 'source3/rpc_parse/parse_prs.c')
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 15 |
1 files 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); |