From: Miloš Mulač Date: Wed, 30 Aug 2006 12:17:14 +0000 (+0000) Subject: name files with sec_usec suffixes X-Git-Tag: merge_30_31_after2~4 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=54ac9a5dddfcf34c09bacd9fc82b01182cc00abe;p=jra1mw.git name files with sec_usec suffixes --- 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); }