From 54ac9a5dddfcf34c09bacd9fc82b01182cc00abe Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Wed, 30 Aug 2006 12:17:14 +0000 Subject: [PATCH] name files with sec_usec suffixes --- org.glite.lb.client/src/lb_dump_exporter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/org.glite.lb.client/src/lb_dump_exporter.c b/org.glite.lb.client/src/lb_dump_exporter.c index 2eb1850..97a63ab 100644 --- a/org.glite.lb.client/src/lb_dump_exporter.c +++ b/org.glite.lb.client/src/lb_dump_exporter.c @@ -9,6 +9,8 @@ #include #include #include +#include + #include "glite/lb/context.h" #include "glite/lb/events.h" @@ -149,8 +151,9 @@ int main(int argc, char **argv) } if ( !(st = dump_storage_find(dstorage, jobid)) ) { - int fd, i; + int fd, i; char fname[PATH_MAX]; + struct timeval tv; i = 0; while ( 1 ) { @@ -159,9 +162,10 @@ int main(int argc, char **argv) perror("Can't create dump file - max tries limit reached "); cleanup(1); } - snprintf(fname, PATH_MAX, "%s/%s.%ld", store_pref, unique, (long) time(NULL)); + gettimeofday(&tv, NULL); + snprintf(fname, PATH_MAX, "%s/%s.%ld_%ld", store_pref, unique, tv.tv_sec, tv.tv_usec); if ( (fd = open(fname, O_CREAT|O_EXCL|O_RDWR, 00640)) < 0 ) { - if ( errno == EEXIST ) { sleep(2); continue; } + if ( errno == EEXIST ) { usleep(1000); continue; } perror(fname); cleanup(1); } -- 1.8.2.3