Bug 1234524 - More informative error in sdb.c r=wtc
authorMichelangelo De Simone <mdesimone@mozilla.com>
Mon, 02 May 2016 16:19:13 -0700
changeset 12142 5b1295e846379cd8935e01136264fcd945bf0368
parent 12141 b3981e62834c24a22729f07be17aa352e098e83b
child 12143 830d52622b911a1f3410095637c948fa430b58c4
push id1195
push userfranziskuskiefer@gmail.com
push dateTue, 03 May 2016 07:23:39 +0000
reviewerswtc
bugs1234524
Bug 1234524 - More informative error in sdb.c r=wtc
lib/softoken/sdb.c
--- a/lib/softoken/sdb.c
+++ b/lib/softoken/sdb.c
@@ -1733,17 +1733,17 @@ sdb_init(char *dbname, char *table, sdbD
 
     /*
      * SQL created the file, but it doesn't set appropriate modes for
      * a database.
      *
      * NO NSPR call for chmod? :(
      */
     if (create && chmod(dbname, 0600) != 0) {
-        error = CKR_DEVICE_ERROR;
+        error = sdb_mapSQLError(type, SQLITE_CANTOPEN);
         goto loser;
     }
 
     if (flags != SDB_RDONLY) {
 	sqlerr = sqlite3_exec(sqlDB, BEGIN_CMD, NULL, 0, NULL);
 	if (sqlerr != SQLITE_OK) {
 	    error = sdb_mapSQLError(type, sqlerr);
 	    goto loser;