[gnome-keyring] [pkcs11] Create necessary directory when storing file.



commit 8cafce73a8b7fc987a0ba2142c89c50b315b5f7b
Author: Stef Walter <stef memberwebs com>
Date:   Fri Dec 24 11:05:55 2010 -0600

    [pkcs11] Create necessary directory when storing file.
    
    When storing files in the xdg-store the necessary directory
    was not created and a warning was issued.

 pkcs11/gkm/gkm-transaction.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/pkcs11/gkm/gkm-transaction.c b/pkcs11/gkm/gkm-transaction.c
index ddadefc..a15f810 100644
--- a/pkcs11/gkm/gkm-transaction.c
+++ b/pkcs11/gkm/gkm-transaction.c
@@ -505,6 +505,12 @@ gkm_transaction_unique_file (GkmTransaction *self, const gchar *directory,
 	g_return_val_if_fail (basename, NULL);
 	g_return_val_if_fail (!gkm_transaction_get_failed (self), NULL);
 
+	if (!g_mkdir_with_parents (directory, S_IRWXU) < 0) {
+		g_warning ("couldn't create directory: %s: %s", directory, g_strerror (errno));
+		gkm_transaction_fail (self, CKR_DEVICE_ERROR);
+		return NULL;
+	}
+
 	filename = g_build_filename (directory, basename, NULL);
 
 	/* Write a zero byte file */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]