Hey Sasha,

As discussed in a previous thread, this patch makes the default caching
behavior in libibnetdisc to overwrite a previous cache.

Al

-- 
Albert Chu
ch...@llnl.gov
Computer Scientist
High Performance Systems Division
Lawrence Livermore National Laboratory
--- Begin Message ---
Signed-off-by: Albert Chu <ch...@llnl.gov>
---
 .../libibnetdisc/src/ibnetdisc_cache.c             |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c 
b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
index 5acb8f6..e05ce99 100644
--- a/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
+++ b/infiniband-diags/libibnetdisc/src/ibnetdisc_cache.c
@@ -889,8 +889,11 @@ int ibnd_cache_fabric(ibnd_fabric_t * fabric, const char 
*file,
        }
 
        if (!stat(file, &statbuf)) {
-               IBND_DEBUG("file '%s' already exists\n", file);
-               return -1;
+               if (unlink(file) < 0) {
+                       IBND_DEBUG("error removing '%s': %s\n",
+                                  file, strerror(errno));
+                       return -1;
+               }
        }
 
        if ((fd = open(file, O_CREAT | O_EXCL | O_WRONLY, 0644)) < 0) {
-- 
1.5.4.5


--- End Message ---

Reply via email to