From 7c0d882bc96664cd4f187487b0ef77ae22b513c7 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Fri, 28 Jul 2017 15:56:21 +0200 Subject: [PATCH] Patch a bug when creating a DMS not in the current directory. Use the basename function to locate the DMS name instead of the loop... --- src/obidms.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/obidms.c b/src/obidms.c index 710eb20..1c6d1fe 100644 --- a/src/obidms.c +++ b/src/obidms.c @@ -19,6 +19,7 @@ #include #include #include +#include /* : Addted the 28 july 2017 to include basename */ #include "obidms.h" #include "obierrno.h" @@ -160,7 +161,9 @@ int create_dms_infos_file(int dms_file_descriptor, const char* dms_name) return -1; // Create file - infos_file_descriptor = openat(dms_file_descriptor, file_name, O_RDWR | O_CREAT | O_EXCL, 0777); + infos_file_descriptor = openat(dms_file_descriptor, + file_name, + O_RDWR | O_CREAT | O_EXCL, 0777); if (infos_file_descriptor < 0) { obi_set_errno(OBIDMS_UNKNOWN_ERROR); @@ -302,6 +305,7 @@ OBIDMS_p obi_create_dms(const char* dms_path) return NULL; } +/* // Isolate the dms name j = 0; for (i=0; idms_name, dms_path+j); +*/ + strcpy(dms->dms_name, basename(dms_path)); // Build and check the directory name including the relative path complete_dms_path = build_directory_name(dms_path);