ldb:tools - always check if ldb connection has been estabilished
[ira/wip.git] / source4 / lib / ldb / tools / ldbrename.c
index 7473a77fda114980f2dc711308f80ee884efbd4c..518358c9a3f9eb0dc5615c61d73548cb76e2effa 100644 (file)
@@ -54,6 +54,9 @@ int main(int argc, const char **argv)
        TALLOC_CTX *mem_ctx = talloc_new(NULL);
 
        ldb = ldb_init(mem_ctx, NULL);
+       if (ldb == NULL) {
+               return LDB_ERR_OPERATIONS_ERROR;
+       }
 
        options = ldb_cmdline_process(ldb, argc, argv, usage);
 
@@ -65,7 +68,7 @@ int main(int argc, const char **argv)
        dn2 = ldb_dn_new(ldb, ldb, options->argv[1]);
 
        ret = ldb_rename(ldb, dn1, dn2);
-       if (ret == 0) {
+       if (ret == LDB_SUCCESS) {
                printf("Renamed 1 record\n");
        } else  {
                printf("rename of '%s' to '%s' failed - %s\n",