"nsdbparams update -f foo -t 1 nsdb.example.net" fails if the
nsdbcerts directory does not already exist.  Create it
automatically.

Signed-off-by: Chuck Lever <[email protected]>
---

 src/libnsdb/nsdb.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c
index 3f10c4d..7ef39d3 100644
--- a/src/libnsdb/nsdb.c
+++ b/src/libnsdb/nsdb.c
@@ -563,6 +563,13 @@ nsdb_new_certfile(const char *certdata, const unsigned int 
certlen,
                goto out;
        }
 
+       if (mkdir(fedfs_nsdbcerts_dirname, FEDFS_BASE_DIRMODE) == -1) {
+               if (errno != EEXIST) {
+                       xlog(L_ERROR, "Failed to create certfile directory: 
%m");
+                       return FEDFS_ERR_SVRFAULT;
+               }
+       }
+
        fd = open(pathbuf, O_WRONLY | O_SYNC | O_CREAT | O_EXCL,
                                                S_IRUSR | S_IWUSR | S_IRGRP);
        if (fd == -1) {


_______________________________________________
fedfs-utils-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel

Reply via email to