r18840: make these compatible with g++ warnings
authorAndrew Tridgell <tridge@samba.org>
Sat, 23 Sep 2006 04:36:30 +0000 (04:36 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:20:15 +0000 (14:20 -0500)
(This used to be commit bcfa93954fdb00f500f174cd227e3d9b2ef94fdc)

source4/lib/ldb/tools/cmdline.c
source4/lib/ldb/tools/ldbedit.c

index 77cdcf4db88afc6d0e952384fe72e62b9051c5ca..cb811452b87e3d4a155cec42d8567488e3c4e30f 100644 (file)
@@ -26,7 +26,7 @@
 #include "ldb/include/includes.h"
 #include "ldb/tools/cmdline.h"
 
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
 #include "lib/cmdline/popt_common.h"
 #include "lib/ldb/samba/ldif_handlers.h"
 #include "auth/auth.h"
@@ -44,7 +44,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
        static struct ldb_cmdline options; /* needs to be static for older compilers */
        struct ldb_cmdline *ret=NULL;
        poptContext pc;
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
        int r;
 #endif
        int num_options = 0;
@@ -70,7 +70,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
                { "output", 'O', POPT_ARG_STRING, &options.output, 0, "Output File", "Output" },
                { NULL,    'o', POPT_ARG_STRING, NULL, 'o', "ldb_connect option", "OPTION" },
                { "controls", 0, POPT_ARG_STRING, NULL, 'c', "controls", NULL },
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
                POPT_COMMON_SAMBA
                POPT_COMMON_CREDENTIALS
                POPT_COMMON_VERSION
@@ -80,7 +80,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
 
        ldb_global_init();
 
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
        r = ldb_register_samba_handlers(ldb);
        if (r != 0) {
                goto failed;
@@ -206,7 +206,7 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, int argc, const
                flags |= LDB_FLG_NOSYNC;
        }
 
-#ifdef _SAMBA_BUILD_
+#if (_SAMBA_BUILD_ >= 4)
        /* Must be after we have processed command line options */
        gensec_init(); 
        
index 24df98d72873d1111d79ab73b91b941f49e0ec0f..17ade152b780fed372235570321846aad3efd2a5 100644 (file)
@@ -189,7 +189,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
 {
        int fd, ret;
        FILE *f;
-       char template[] = "/tmp/ldbedit.XXXXXX";
+       char file_template[] = "/tmp/ldbedit.XXXXXX";
        char *cmd;
        struct ldb_ldif *ldif;
        struct ldb_message **msgs2 = NULL;
@@ -197,10 +197,10 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
 
        /* write out the original set of messages to a temporary
           file */
-       fd = mkstemp(template);
+       fd = mkstemp(file_template);
 
        if (fd == -1) {
-               perror(template);
+               perror(file_template);
                return -1;
        }
 
@@ -209,7 +209,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
        if (!f) {
                perror("fopen");
                close(fd);
-               unlink(template);
+               unlink(file_template);
                return -1;
        }
 
@@ -219,10 +219,10 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
 
        fclose(f);
 
-       cmd = talloc_asprintf(ldb, "%s %s", editor, template);
+       cmd = talloc_asprintf(ldb, "%s %s", editor, file_template);
 
        if (!cmd) {
-               unlink(template);
+               unlink(file_template);
                fprintf(stderr, "out of memory\n");
                return -1;
        }
@@ -232,15 +232,15 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
        talloc_free(cmd);
 
        if (ret != 0) {
-               unlink(template);
+               unlink(file_template);
                fprintf(stderr, "edit with %s failed\n", editor);
                return -1;
        }
 
        /* read the resulting ldif into msgs2 */
-       f = fopen(template, "r");
+       f = fopen(file_template, "r");
        if (!f) {
-               perror(template);
+               perror(file_template);
                return -1;
        }
 
@@ -254,7 +254,7 @@ static int do_edit(struct ldb_context *ldb, struct ldb_message **msgs1, int coun
        }
 
        fclose(f);
-       unlink(template);
+       unlink(file_template);
 
        return merge_edits(ldb, msgs1, count1, msgs2, count2);
 }