Print an error message if database could not be opened.
authorVolker Lendecke <vlendec@samba.org>
Sat, 4 Aug 2001 18:17:30 +0000 (18:17 +0000)
committerVolker Lendecke <vlendec@samba.org>
Sat, 4 Aug 2001 18:17:30 +0000 (18:17 +0000)
Volker
(This used to be commit b4f06c3ecf8af60352bc9e3af9c35c00827faad2)

source3/tdb/tdbtool.c

index 8c09c76df554ac3fddab2ad64f0eee2501c77900..8b396ca5a2a69c9fa4c0a7557bf0ac730a73ca5a 100644 (file)
@@ -1,3 +1,4 @@
+#include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -111,6 +112,9 @@ static void create_tdb(void)
        if (tdb) tdb_close(tdb);
        tdb = tdb_open(tok, 0, TDB_CLEAR_IF_FIRST,
                       O_RDWR | O_CREAT | O_TRUNC, 0600);
+       if (!tdb) {
+               printf("Could not create %s: %s\n", tok, strerror(errno));
+       }
 }
 
 static void open_tdb(void)
@@ -122,6 +126,9 @@ static void open_tdb(void)
        }
        if (tdb) tdb_close(tdb);
        tdb = tdb_open(tok, 0, 0, O_RDWR, 0600);
+       if (!tdb) {
+               printf("Could not open %s: %s\n", tok, strerror(errno));
+       }
 }
 
 static void insert_tdb(void)