]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Avoid using shadow variables. Unfortunately -Wshadow also complains about
authorTimo Sirainen <tss@iki.fi>
Mon, 26 May 2008 23:09:47 +0000 (02:09 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 26 May 2008 23:09:47 +0000 (02:09 +0300)
index variable conflicting with index(), which is used in way too many
places to change.

--HG--
branch : HEAD

32 files changed:
src/auth/auth-master-listener.c
src/auth/db-passwd-file.c
src/auth/userdb-nss.c
src/deliver/auth-client.c
src/deliver/deliver.c
src/deliver/duplicate.c
src/deliver/duplicate.h
src/imap/imap-fetch-body.c
src/imap/imap-thread.c
src/lib-imap/imap-date.c
src/lib-imap/imap-date.h
src/lib-index/mail-cache-compress.c
src/lib-index/mail-index-map.c
src/lib-mail/mbox-from.c
src/lib-mail/mbox-from.h
src/lib-mail/message-date.c
src/lib-mail/message-date.h
src/lib-storage/index/dbox/dbox-index.c
src/lib-storage/index/index-sync.c
src/lib-storage/index/mbox/mbox-sync.c
src/lib-storage/list/mailbox-list-fs-iter.c
src/lib/module-dir.c
src/lib/restrict-access.c
src/master/dict-process.c
src/master/listener.c
src/master/mail-process.c
src/master/mail-process.h
src/master/master-settings.c
src/plugins/fts-squat/squat-trie.c
src/plugins/quota/quota-fs.c
src/util/idxview.c
src/util/rawlog.c

index 6bf313168b8430040bb3bcb7466555b73564da6b..0d6b82c947210a12aaa7a1528781469dc97d8186 100644 (file)
@@ -40,16 +40,16 @@ struct auth_master_listener *auth_master_listener_create(struct auth *auth)
 }
 
 static void
-auth_master_listener_socket_free(struct auth_master_listener_socket *socket)
+auth_master_listener_socket_free(struct auth_master_listener_socket *s)
 {
-       if (socket->path != NULL) {
-               (void)unlink(socket->path);
-               i_free(socket->path);
+       if (s->path != NULL) {
+               (void)unlink(s->path);
+               i_free(s->path);
        }
 
-       io_remove(&socket->io);
-       net_disconnect(socket->fd);
-       i_free(socket);
+       io_remove(&s->io);
+       net_disconnect(s->fd);
+       i_free(s);
 }
 
 void auth_master_listener_destroy(struct auth_master_listener *listener)
index ccf8a2543af45f2a68c76a246daaee6422ef90a7..f9d6015451334325c74dbaec7e1a94f1bf28183b 100644 (file)
@@ -385,15 +385,12 @@ db_passwd_file_lookup(struct db_passwd_file *db, struct auth_request *request)
        struct passwd_file *pw;
        struct passwd_user *pu;
        const struct var_expand_table *table;
-       string_t *username;
+       string_t *username, *dest;
        const char *path;
 
        if (!db->vars)
                pw = db->default_file;
        else {
-               const struct var_expand_table *table;
-               string_t *dest;
-
                table = auth_request_get_var_expand_table(request, path_fix);
                dest = t_str_new(256);
                var_expand(dest, db->path, table);
index 3b750a74ab9cae0add600f6aa2d1a0a7c11ad332..acc2f4976b44b3201f4353046b1f1a77dc1919a2 100644 (file)
@@ -130,13 +130,13 @@ userdb_nss_preinit(struct auth_userdb *auth_userdb, const char *args)
 static void userdb_nss_deinit(struct userdb_module *_module)
 {
        struct nss_userdb_module *module = (struct nss_userdb_module *)_module;
-       void (*endpwent)(void);
+       void (*mod_endpwent)(void);
+       const char *symbol;
 
-       endpwent = module_get_symbol(&module->nss_module,
-                                    t_strdup_printf("_nss_%s_endpwent",
-                                                    module->nss_module.name));
-       if (endpwent != NULL)
-               endpwent();
+       symbol = t_strdup_printf("_nss_%s_endpwent", module->nss_module.name);
+       mod_endpwent = module_get_symbol(&module->nss_module, symbol);
+       if (mod_endpwent != NULL)
+               mod_endpwent();
 }
 
 struct userdb_module_interface userdb_nss = {
index 8a82344a853d9ecb68604f17ca66935425d4e691..90bb612d2d2f5acd9850088868d4e378ace40623 100644 (file)
@@ -95,7 +95,7 @@ static void auth_parse_input(struct auth_connection *conn, const char *args)
        const char *const *tmp, *extra_groups;
        uid_t uid = 0;
        gid_t gid = 0;
-       const char *chroot = getenv("MAIL_CHROOT");
+       const char *chroot_dir = getenv("MAIL_CHROOT");
        const char *home_dir = NULL;
        bool debug = getenv("DEBUG") != NULL;
        unsigned int len;
@@ -121,7 +121,7 @@ static void auth_parse_input(struct auth_connection *conn, const char *args)
                                return_value = EX_TEMPFAIL;
                        }
                } else if (strncmp(*tmp, "chroot=", 7) == 0) {
-                       chroot = *tmp + 7;
+                       chroot_dir = *tmp + 7;
                } else {
                        char *field = i_strdup(*tmp);
 
@@ -162,15 +162,15 @@ static void auth_parse_input(struct auth_connection *conn, const char *args)
        if (conn->euid == 0 || getegid() != gid)
                env_put(t_strconcat("RESTRICT_SETGID=", dec2str(gid), NULL));
 
-       if (chroot != NULL) {
-               len = strlen(chroot);
-               if (len > 2 && strcmp(chroot + len - 2, "/.") == 0 &&
+       if (chroot_dir != NULL) {
+               len = strlen(chroot_dir);
+               if (len > 2 && strcmp(chroot_dir + len - 2, "/.") == 0 &&
                    home_dir != NULL &&
-                   strncmp(home_dir, chroot, len - 2) == 0) {
+                   strncmp(home_dir, chroot_dir, len - 2) == 0) {
                        /* strip chroot dir from home dir */
                        home_dir += len - 2;
                }
-               env_put(t_strconcat("RESTRICT_CHROOT=", chroot, NULL));
+               env_put(t_strconcat("RESTRICT_CHROOT=", chroot_dir, NULL));
        }
        if (home_dir != NULL)
                env_put(t_strconcat("HOME=", home_dir, NULL));
index 7052305eb6900faf7c3a6474df183332fd832598..289ef837d33ce29234430fb91abc469c12a79deb 100644 (file)
@@ -711,7 +711,7 @@ int main(int argc, char *argv[])
        const char *config_path = DEFAULT_CONFIG_FILE;
        const char *mailbox = "INBOX";
        const char *auth_socket;
-       const char *home, *destaddr, *user, *value, *error;
+       const char *home, *destaddr, *user, *value, *errstr;
        ARRAY_TYPE(string) extra_fields;
        struct mail_namespace *ns, *raw_ns;
        struct mail_storage *storage;
@@ -938,8 +938,8 @@ int main(int argc, char *argv[])
        raw_ns = mail_namespaces_init_empty(namespace_pool);
        raw_ns->flags |= NAMESPACE_FLAG_INTERNAL;
        if (mail_storage_create(raw_ns, "raw", "/tmp", user,
-                               0, FILE_LOCK_METHOD_FCNTL, &error) < 0)
-               i_fatal("Couldn't create internal raw storage: %s", error);
+                               0, FILE_LOCK_METHOD_FCNTL, &errstr) < 0)
+               i_fatal("Couldn't create internal raw storage: %s", errstr);
        input = create_raw_stream(0, &mtime);
        box = mailbox_open(raw_ns->storage, "Dovecot Delivery Mail", input,
                           MAILBOX_OPEN_NO_INDEX_FILES);
@@ -991,7 +991,6 @@ int main(int argc, char *argv[])
        if (ret < 0 ) {
                const char *error_string;
                enum mail_error error;
-               int ret;
 
                if (storage == NULL) {
                        /* This shouldn't happen */
index 34d9cca0449df0ee9be339e2d23426814d6fb416..846d46d55c7a9ea53db5de566ffa756538b9c7d6 100644 (file)
@@ -245,7 +245,7 @@ int duplicate_check(const void *id, size_t id_size, const char *user)
 }
 
 void duplicate_mark(const void *id, size_t id_size,
-                    const char *user, time_t time)
+                    const char *user, time_t timestamp)
 {
        struct duplicate *d;
        void *new_id;
@@ -260,7 +260,7 @@ void duplicate_mark(const void *id, size_t id_size,
        d->id = new_id;
        d->id_size = id_size;
        d->user = p_strdup(duplicate_file->pool, user);
-       d->time = time;
+       d->time = timestamp;
 
        duplicate_file->changed = TRUE;
        hash_insert(duplicate_file->hash, d, d);
index ed3ac5fa78f5a25f9aa6cde8d39d9d7454e6437a..c31402c71c75edbee6d16b9b186b79d5e9b9eda2 100644 (file)
@@ -5,7 +5,7 @@
 
 int duplicate_check(const void *id, size_t id_size, const char *user);
 void duplicate_mark(const void *id, size_t id_size,
-                    const char *user, time_t time);
+                    const char *user, time_t timestamp);
 
 void duplicate_flush(void);
 
index 7f77138cbc72df17a01ae942711394fe69425f9c..9a102a02ccb1822e5f241fc76810a517b8e186e3 100644 (file)
@@ -41,7 +41,7 @@ struct partial_cache {
        struct message_size pos;
 };
 
-static struct partial_cache partial = { 0, 0, 0, 0, { 0, 0, 0 } };
+static struct partial_cache last_partial = { 0, 0, 0, 0, { 0, 0, 0 } };
 
 static bool seek_partial(unsigned int select_counter, unsigned int uid,
                         struct partial_cache *partial, struct istream *stream,
@@ -224,10 +224,10 @@ static int fetch_stream_send(struct imap_fetch_context *ctx)
 
        ctx->cur_offset += ret;
        if (ctx->update_partial) {
-               partial.cr_skipped = ctx->skip_cr != 0;
-               partial.pos.physical_size =
-                       ctx->cur_input->v_offset - partial.physical_start;
-               partial.pos.virtual_size += ret;
+               last_partial.cr_skipped = ctx->skip_cr != 0;
+               last_partial.pos.physical_size =
+                       ctx->cur_input->v_offset - last_partial.physical_start;
+               last_partial.pos.virtual_size += ret;
        }
 
        return ctx->cur_offset == ctx->cur_size;
@@ -312,7 +312,7 @@ static int fetch_data(struct imap_fetch_context *ctx,
        } else {
                ctx->skip_cr =
                        seek_partial(ctx->select_counter, ctx->cur_mail->uid,
-                                    &partial, ctx->cur_input, body->skip);
+                                    &last_partial, ctx->cur_input, body->skip);
        }
 
        return fetch_stream(ctx, size);
index f3ab6c91713d4b2411c90483fa1548d1502e01dd..ce2bc51b7ed89259683949660e9b1d28cdb4cc19 100644 (file)
@@ -939,8 +939,7 @@ static void mail_thread_finish(struct thread_context *ctx)
        /* (2) save root nodes and drop the msgids */
        iter = hash_iterate_init(ctx->msgid_hash);
        while (hash_iterate(iter, &key, &value)) {
-               struct node *node = value;
-
+               node = value;
                if (node->parent == NULL)
                        add_root(ctx, node);
        }
index 268960f63e17b9c3719a3f5cd1b94544c3100b1d..2ff72896400658269975471377479940d56335ef 100644 (file)
@@ -105,7 +105,7 @@ static bool imap_mktime(struct tm *tm, time_t *time_r)
        return FALSE;
 }
 
-bool imap_parse_date(const char *str, time_t *time)
+bool imap_parse_date(const char *str, time_t *timestamp_r)
 {
        struct tm tm;
 
@@ -114,11 +114,12 @@ bool imap_parse_date(const char *str, time_t *time)
                return FALSE;
 
        tm.tm_isdst = -1;
-       (void)imap_mktime(&tm, time);
+       (void)imap_mktime(&tm, timestamp_r);
        return TRUE;
 }
 
-bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset)
+bool imap_parse_datetime(const char *str, time_t *timestamp_r,
+                        int *timezone_offset_r)
 {
        struct tm tm;
 
@@ -149,22 +150,22 @@ bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset)
        str += 3;
 
        /* timezone */
-       *timezone_offset = parse_timezone(str);
+       *timezone_offset_r = parse_timezone(str);
 
        tm.tm_isdst = -1;
-       if (imap_mktime(&tm, time))
-               *time -= *timezone_offset * 60;
+       if (imap_mktime(&tm, timestamp_r))
+               *timestamp_r -= *timezone_offset_r * 60;
        return TRUE;
 }
 
-const char *imap_to_datetime(time_t time)
+const char *imap_to_datetime(time_t timestamp)
 {
        char *buf;
        struct tm *tm;
        int timezone_offset, year;
 
-       tm = localtime(&time);
-       timezone_offset = utc_offset(tm, time);
+       tm = localtime(&timestamp);
+       timezone_offset = utc_offset(tm, timestamp);
 
        /* @UNSAFE: but faster than t_strdup_printf() call.. */
        buf = t_malloc(27);
index 6e6ea036de6778258e366572657f4f727304a8c6..475bb3814d64cf0452fd104c4be4889b2701ea73 100644 (file)
@@ -8,10 +8,11 @@
    If date is too low or too high to fit to time_t, it's set to lowest/highest
    allowed value. This allows you to use the value directly for comparing
    timestamps. */
-bool imap_parse_date(const char *str, time_t *time);
-bool imap_parse_datetime(const char *str, time_t *time, int *timezone_offset);
+bool imap_parse_date(const char *str, time_t *timestamp_r);
+bool imap_parse_datetime(const char *str, time_t *timestamp_r,
+                        int *timezone_offset_r);
 
 /* Returns given UTC time in local timezone. */
-const char *imap_to_datetime(time_t time);
+const char *imap_to_datetime(time_t timestamp);
 
 #endif
index 6b3624ee681fb0cc96bacbbb63927e9648a633e0..ece39327fc1eec322e074c71cb7e79b71e67b864 100644 (file)
@@ -199,28 +199,28 @@ mail_cache_copy(struct mail_cache *cache, struct mail_index_transaction *trans,
                used_fields_count = i;
        } else {
                for (i = used_fields_count = 0; i < orig_fields_count; i++) {
-                       struct mail_cache_field_private *field =
+                       struct mail_cache_field_private *priv =
                                &cache->fields[i];
                        enum mail_cache_decision_type dec =
-                               field->field.decision;
+                               priv->field.decision;
 
                        /* if the decision isn't forced and this field hasn't
                           been accessed for a while, drop it */
                        if ((dec & MAIL_CACHE_DECISION_FORCED) == 0 &&
-                           (time_t)field->last_used < max_drop_time &&
-                           !field->adding) {
+                           (time_t)priv->last_used < max_drop_time &&
+                           !priv->adding) {
                                dec = MAIL_CACHE_DECISION_NO;
-                               field->field.decision = dec;
+                               priv->field.decision = dec;
                        }
 
                        /* drop all fields we don't want */
                        if ((dec & ~MAIL_CACHE_DECISION_FORCED) ==
-                           MAIL_CACHE_DECISION_NO && !field->adding) {
-                               field->used = FALSE;
-                               field->last_used = 0;
+                           MAIL_CACHE_DECISION_NO && !priv->adding) {
+                               priv->used = FALSE;
+                               priv->last_used = 0;
                        }
 
-                       ctx.field_file_map[i] = !field->used ?
+                       ctx.field_file_map[i] = !priv->used ?
                                (uint32_t)-1 : used_fields_count++;
                }
        }
index 4d7bbed265a1bd7b5a57a707053c055467604b5b..ec10eb0351c5c1dd68e426e6464d4f135483a058 100644 (file)
@@ -331,11 +331,11 @@ int mail_index_map_parse_keywords(struct mail_index_map *map)
        for (i = 0; i < array_count(&map->keyword_idx_map); i++) {
                const char *keyword = name + kw_rec[i].name_offset;
                const unsigned int *old_idx;
-               unsigned int idx;
+               unsigned int kw_idx;
 
                old_idx = array_idx(&map->keyword_idx_map, i);
-               if (!mail_index_keyword_lookup(index, keyword, &idx) ||
-                   idx != *old_idx) {
+               if (!mail_index_keyword_lookup(index, keyword, &kw_idx) ||
+                   kw_idx != *old_idx) {
                        mail_index_set_error(index, "Corrupted index file %s: "
                                             "Keywords changed unexpectedly",
                                             index->filepath);
@@ -347,7 +347,7 @@ int mail_index_map_parse_keywords(struct mail_index_map *map)
        i = array_count(&map->keyword_idx_map);
        for (; i < kw_hdr->keywords_count; i++) {
                const char *keyword = name + kw_rec[i].name_offset;
-               unsigned int idx;
+               unsigned int kw_idx;
 
                if (*keyword == '\0') {
                        mail_index_set_error(index, "Corrupted index file %s: "
@@ -355,8 +355,8 @@ int mail_index_map_parse_keywords(struct mail_index_map *map)
                                index->filepath);
                        return -1;
                }
-               mail_index_keyword_lookup_or_create(index, keyword, &idx);
-               array_append(&map->keyword_idx_map, &idx, 1);
+               mail_index_keyword_lookup_or_create(index, keyword, &kw_idx);
+               array_append(&map->keyword_idx_map, &kw_idx, 1);
        }
        return 0;
 }
index b7f39c22ae9b19c3f0f89ace89b27376f50a6b1c..8c0d874f2cb4bc9e98464bf32fe195a01f1f1a01 100644 (file)
@@ -54,7 +54,7 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
 {
        const unsigned char *msg_start, *sender_end, *msg_end;
        struct tm tm;
-       int esc, alt_stamp, timezone = 0, seen_timezone = FALSE;
+       int esc, alt_stamp, timezone_secs = 0, seen_timezone = FALSE;
        time_t t;
 
        *time_r = (time_t)-1;
@@ -198,9 +198,9 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
                   i_isdigit(msg[3]) && i_isdigit(msg[4]) && msg[5] == ' ') {
                /* numeric timezone, use it */
                 seen_timezone = TRUE;
-               timezone = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
+               timezone_secs = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
                        (msg[3]-'0') * 10 + (msg[4]-'0');
-               if (msg[0] == '-') timezone = -timezone;
+               if (msg[0] == '-') timezone_secs = -timezone_secs;
                msg += 6;
        }
 
@@ -217,9 +217,9 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
            i_isdigit(msg[2]) && i_isdigit(msg[3]) &&
            i_isdigit(msg[4]) && i_isdigit(msg[5])) {
                seen_timezone = TRUE;
-               timezone = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
+               timezone_secs = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
                        (msg[4]-'0') * 10 + (msg[5]-'0');
-               if (msg[1] == '-') timezone = -timezone;
+               if (msg[1] == '-') timezone_secs = -timezone_secs;
        }
 
        if (seen_timezone) {
@@ -227,7 +227,7 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
                if (t == (time_t)-1)
                        return -1;
 
-               t -= timezone;
+               t -= timezone_secs;
                *time_r = t;
        } else {
                /* assume local timezone */
@@ -238,7 +238,7 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
        return 0;
 }
 
-const char *mbox_from_create(const char *sender, time_t time)
+const char *mbox_from_create(const char *sender, time_t timestamp)
 {
        string_t *str;
        struct tm *tm;
@@ -251,7 +251,7 @@ const char *mbox_from_create(const char *sender, time_t time)
 
        /* we could use simply asctime(), but i18n etc. may break it.
           Example: "Thu Nov 29 22:33:52 2001" */
-       tm = localtime(&time);
+       tm = localtime(&timestamp);
 
        /* week day */
        str_append(str, weekdays[tm->tm_wday]);
index 71d1f924a48fa13ddb68bffa75d78e3661a35d1b..e4557bb302d6d8e7d01a6b9de95406f42909328c 100644 (file)
@@ -7,6 +7,6 @@ int mbox_from_parse(const unsigned char *msg, size_t size,
                    time_t *time_r, char **sender_r);
 /* Return a mbox-compatible From_-line using given sender and time.
    The returned string begins with "From ". */
-const char *mbox_from_create(const char *sender, time_t time);
+const char *mbox_from_create(const char *sender, time_t timestamp);
 
 #endif
index 7e0dd34dcb0a10f40272005866debad624f86ef7..cb0227ae31273fd292b5c64d3ab074116a42adda 100644 (file)
@@ -105,8 +105,9 @@ static int next_token(struct message_date_parser_context *ctx,
        return ret < 0 ? -1 : *value_len > 0;
 }
 
-static bool message_date_parser_tokens(struct message_date_parser_context *ctx,
-                                      time_t *time, int *timezone_offset)
+static bool
+message_date_parser_tokens(struct message_date_parser_context *ctx,
+                          time_t *timestamp_r, int *timezone_offset_r)
 {
        struct tm tm;
        const unsigned char *value;
@@ -212,24 +213,24 @@ static bool message_date_parser_tokens(struct message_date_parser_context *ctx,
                return FALSE;
        if (ret == 0) {
                /* missing timezone */
-               *timezone_offset = 0;
+               *timezone_offset_r = 0;
        } else {
                /* timezone */
-               *timezone_offset = parse_timezone(value, len);
+               *timezone_offset_r = parse_timezone(value, len);
        }
 
        tm.tm_isdst = -1;
-       *time = utc_mktime(&tm);
-       if (*time == (time_t)-1)
+       *timestamp_r = utc_mktime(&tm);
+       if (*timestamp_r == (time_t)-1)
                return FALSE;
 
-       *time -= *timezone_offset * 60;
+       *timestamp_r -= *timezone_offset_r * 60;
 
        return TRUE;
 }
 
 bool message_date_parse(const unsigned char *data, size_t size,
-                      time_t *time, int *timezone_offset)
+                       time_t *timestamp_r, int *timezone_offset_r)
 {
        bool success;
 
@@ -238,21 +239,21 @@ bool message_date_parse(const unsigned char *data, size_t size,
 
                rfc822_parser_init(&ctx.parser, data, size, NULL);
                ctx.str = t_str_new(128);
-               success = message_date_parser_tokens(&ctx, time,
-                                                    timezone_offset);
+               success = message_date_parser_tokens(&ctx, timestamp_r,
+                                                    timezone_offset_r);
        } T_END;
 
        return success;
 }
 
-const char *message_date_create(time_t time)
+const char *message_date_create(time_t timestamp)
 {
        struct tm *tm;
        int offset;
        bool negative;
 
-       tm = localtime(&time);
-       offset = utc_offset(tm, time);
+       tm = localtime(&timestamp);
+       offset = utc_offset(tm, timestamp);
        if (offset >= 0)
                negative = FALSE;
        else {
index 6fe98a15bab98e634cc6bc1b0df85b40563d804d..fb1364b186e4aa6382cc6b18f443fdfbd4cea930 100644 (file)
@@ -4,9 +4,9 @@
 /* Parses RFC2822 date/time string. timezone_offset is filled with the
    timezone's difference to UTC in minutes. */
 bool message_date_parse(const unsigned char *data, size_t size,
-                       time_t *time, int *timezone_offset);
+                       time_t *timestamp_r, int *timezone_offset_r);
 
 /* Create RFC2822 date/time string from given time in local timezone. */
-const char *message_date_create(time_t time);
+const char *message_date_create(time_t timestamp);
 
 #endif
index cc68c29b3755d7f10d5912e422f6e59dd32772ad..8812e8826797e35079b3c42dfc69b76265a987b2 100644 (file)
@@ -155,11 +155,11 @@ static void dbox_index_header_init(struct dbox_index *index,
                                   struct dbox_index_file_header *hdr)
 {
        if (index->uid_validity == 0) {
-               const struct mail_index_header *hdr;
+               const struct mail_index_header *idx_hdr;
 
-               hdr = mail_index_get_header(index->mbox->ibox.view);
-               index->uid_validity = hdr->uid_validity != 0 ?
-                       hdr->uid_validity : (uint32_t)ioloop_time;
+               idx_hdr = mail_index_get_header(index->mbox->ibox.view);
+               index->uid_validity = idx_hdr->uid_validity != 0 ?
+                       idx_hdr->uid_validity : (uint32_t)ioloop_time;
        }
 
        memset(hdr, ' ', sizeof(*hdr));
index 83c12dd0f4a2c202b681a17abd52f0f105713d86..6326ed797e094313ed897ebf8e3e906a6d72c2e8 100644 (file)
@@ -118,12 +118,12 @@ static void index_mailbox_expunge_recent(struct index_mailbox *ibox,
 
 static void index_view_sync_recs_get(struct index_mailbox_sync_context *ctx)
 {
-       struct mail_index_view_sync_rec sync;
+       struct mail_index_view_sync_rec sync_rec;
        uint32_t seq1, seq2;
 
        i_array_init(&ctx->flag_updates, 128);
-       while (mail_index_view_sync_next(ctx->sync_ctx, &sync)) {
-               switch (sync.type) {
+       while (mail_index_view_sync_next(ctx->sync_ctx, &sync_rec)) {
+               switch (sync_rec.type) {
                case MAIL_INDEX_SYNC_TYPE_APPEND:
                        /* not interested */
                        break;
@@ -135,7 +135,8 @@ static void index_view_sync_recs_get(struct index_mailbox_sync_context *ctx)
                case MAIL_INDEX_SYNC_TYPE_KEYWORD_REMOVE:
                case MAIL_INDEX_SYNC_TYPE_KEYWORD_RESET:
                        if (mail_index_lookup_seq_range(ctx->ibox->view,
-                                                       sync.uid1, sync.uid2,
+                                                       sync_rec.uid1,
+                                                       sync_rec.uid2,
                                                        &seq1, &seq2)) {
                                seq_range_array_add_range(&ctx->flag_updates,
                                                          seq1, seq2);
index 6605f027b44820eb93bc6d2c6a29989d3b06b716..fc632b05739cb49fcb5247c97bb62ec4c97d70b5 100644 (file)
@@ -1656,7 +1656,6 @@ again:
                   before index syncing is started to avoid deadlocks, so we
                   don't have much choice either (well, easy ones anyway). */
                int lock_type = mbox->mbox_readonly ? F_RDLCK : F_WRLCK;
-               int ret;
 
                if ((ret = mbox_lock(mbox, lock_type, &lock_id)) <= 0) {
                        if (ret == 0 || lock_type == F_RDLCK)
index 926be9e6d282b6ab401fe2f96dad03b285418958..159ee08803876478e8efb79eea3faca9be693e17 100644 (file)
@@ -574,9 +574,9 @@ fs_list_dir_next(struct fs_list_iterate_context *ctx)
 
        if (dir->dirp != NULL) {
                if (dir->next_entry != NULL) {
-                       const struct list_dir_entry *ret = dir->next_entry;
+                       const struct list_dir_entry *entry = dir->next_entry;
                        dir->next_entry = NULL;
-                       return ret;
+                       return entry;
                }
                d = readdir(dir->dirp);
                if (d == NULL)
index d8ef603c823e6a8f738786d47df58bced406371b..ab912ae4a4e2f983f252d2a453ba039499fa4f4d 100644 (file)
@@ -250,9 +250,9 @@ module_dir_load_real(const char *dir, const char *module_names,
 
        module_pos = &modules;
        for (i = 0; i < count; i++) T_BEGIN {
-               const char *name = names_p[i];
                const char *path, *stripped_name;
 
+               name = names_p[i];
                stripped_name = module_file_get_name(name);
                if (!module_want_load(module_names_arr, stripped_name))
                        module = NULL;
index 5391d28b78c057d8bd3e6bc10e08d691a0c7a352..a05af978283ff9072679a35c8a33aafc3bb3aa68 100644 (file)
@@ -12,8 +12,9 @@
 #include <time.h>
 #include <grp.h>
 
-static gid_t primary_gid = (gid_t)-1, privileged_gid = (gid_t)-1;
-static bool using_priv_gid = FALSE;
+static gid_t process_primary_gid = (gid_t)-1;
+static gid_t process_privileged_gid = (gid_t)-1;
+static bool process_using_priv_gid = FALSE;
 
 void restrict_access_set_env(const char *user, uid_t uid,
                             gid_t gid, gid_t privileged_gid,
@@ -160,7 +161,7 @@ static void fix_groups_list(const char *extra_groups,
        /* if we're using a privileged GID, we can temporarily drop our
           effective GID. we still want to be able to use its privileges,
           so add it to supplementary groups. */
-       add_primary_gid = privileged_gid != (gid_t)-1;
+       add_primary_gid = process_privileged_gid != (gid_t)-1;
 
        tmp = extra_groups == NULL ? &empty :
                t_strsplit_spaces(extra_groups, ", ");
@@ -171,7 +172,7 @@ static void fix_groups_list(const char *extra_groups,
                                       have_root_group);
                /* see if the list already contains the primary GID */
                for (i = 0; i < gid_count; i++) {
-                       if (gid_list[i] == primary_gid) {
+                       if (gid_list[i] == process_primary_gid) {
                                add_primary_gid = FALSE;
                                break;
                        }
@@ -184,7 +185,7 @@ static void fix_groups_list(const char *extra_groups,
                /* Some OSes don't like an empty groups list,
                   so use the primary GID as the only one. */
                gid_list = t_new(gid_t, 2);
-               gid_list[0] = primary_gid;
+               gid_list[0] = process_primary_gid;
                gid_count = 1;
                add_primary_gid = FALSE;
        }
@@ -195,11 +196,11 @@ static void fix_groups_list(const char *extra_groups,
                memcpy(gid_list2, gid_list, gid_count * sizeof(gid_t));
                for (; *tmp != NULL; tmp++) {
                        gid = get_group_id(*tmp);
-                       if (gid != primary_gid)
+                       if (gid != process_primary_gid)
                                gid_list2[gid_count++] = gid;
                }
                if (add_primary_gid)
-                       gid_list2[gid_count++] = primary_gid;
+                       gid_list2[gid_count++] = process_primary_gid;
                gid_list = gid_list2;
        }
 
@@ -224,28 +225,30 @@ void restrict_access_by_env(bool disallow_root)
 
        /* set the primary/privileged group */
        env = getenv("RESTRICT_SETGID");
-       primary_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
+       process_primary_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
                (gid_t)strtoul(env, NULL, 10);
        env = getenv("RESTRICT_SETGID_PRIV");
-       privileged_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
+       process_privileged_gid = env == NULL || *env == '\0' ? (gid_t)-1 :
                (gid_t)strtoul(env, NULL, 10);
 
-       have_root_group = primary_gid == 0;
-       if (primary_gid != (gid_t)-1 || privileged_gid != (gid_t)-1) {
-               if (primary_gid == (gid_t)-1)
-                       primary_gid = getegid();
-               restrict_init_groups(primary_gid, privileged_gid);
+       have_root_group = process_primary_gid == 0;
+       if (process_primary_gid != (gid_t)-1 ||
+           process_privileged_gid != (gid_t)-1) {
+               if (process_primary_gid == (gid_t)-1)
+                       process_primary_gid = getegid();
+               restrict_init_groups(process_primary_gid,
+                                    process_privileged_gid);
        } else {
-               if (primary_gid == (gid_t)-1)
-                       primary_gid = getegid();
+               if (process_primary_gid == (gid_t)-1)
+                       process_primary_gid = getegid();
        }
 
        /* set system user's groups */
        env = getenv("RESTRICT_USER");
        if (env != NULL && *env != '\0' && is_root) {
-               if (initgroups(env, primary_gid) < 0) {
+               if (initgroups(env, process_primary_gid) < 0) {
                        i_fatal("initgroups(%s, %s) failed: %m",
-                               env, dec2str(primary_gid));
+                               env, dec2str(process_primary_gid));
                }
                preserve_groups = TRUE;
        }
@@ -303,18 +306,18 @@ void restrict_access_by_env(bool disallow_root)
        env = getenv("RESTRICT_GID_FIRST");
        if (env != NULL && atoi(env) != 0)
                allow_root_gid = FALSE;
-       else if (primary_gid == 0 || privileged_gid == 0)
+       else if (process_primary_gid == 0 || process_privileged_gid == 0)
                allow_root_gid = TRUE;
        else
                allow_root_gid = FALSE;
 
        if (!allow_root_gid && uid != 0) {
                if (getgid() == 0 || getegid() == 0 || setgid(0) == 0) {
-                       if (primary_gid == 0)
+                       if (process_primary_gid == 0)
                                i_fatal("GID 0 isn't permitted");
                        i_fatal("We couldn't drop root group privileges "
                                "(wanted=%s, gid=%s, egid=%s)",
-                               dec2str(primary_gid),
+                               dec2str(process_primary_gid),
                                dec2str(getgid()), dec2str(getegid()));
                }
        }
@@ -323,7 +326,7 @@ void restrict_access_by_env(bool disallow_root)
        env_put("RESTRICT_USER=");
        env_put("RESTRICT_CHROOT=");
        env_put("RESTRICT_SETUID=");
-       if (privileged_gid == (gid_t)-1) {
+       if (process_privileged_gid == (gid_t)-1) {
                /* if we're dropping privileges before executing and
                   a privileged group is set, the groups must be fixed
                   after exec */
@@ -337,29 +340,29 @@ void restrict_access_by_env(bool disallow_root)
 
 int restrict_access_use_priv_gid(void)
 {
-       i_assert(!using_priv_gid);
+       i_assert(!process_using_priv_gid);
 
-       if (privileged_gid == (gid_t)-1)
+       if (process_privileged_gid == (gid_t)-1)
                return 0;
-       if (setegid(privileged_gid) < 0) {
+       if (setegid(process_privileged_gid) < 0) {
                i_error("setegid(privileged) failed: %m");
                return -1;
        }
-       using_priv_gid = TRUE;
+       process_using_priv_gid = TRUE;
        return 0;
 }
 
 void restrict_access_drop_priv_gid(void)
 {
-       if (!using_priv_gid)
+       if (!process_using_priv_gid)
                return;
 
-       if (setegid(primary_gid) < 0)
+       if (setegid(process_primary_gid) < 0)
                i_fatal("setegid(primary) failed: %m");
-       using_priv_gid = FALSE;
+       process_using_priv_gid = FALSE;
 }
 
 bool restrict_access_have_priv_gid(void)
 {
-       return privileged_gid != (gid_t)-1;
+       return process_privileged_gid != (gid_t)-1;
 }
index eb7fcf7e5407388239e7c2b9a6a566d08b6b75f3..3fec00cd8a74d569fa18affe4da0dc3a671c9f00 100644 (file)
@@ -25,7 +25,7 @@ struct dict_process {
        struct io *io;
 };
 
-static struct dict_process *process;
+static struct dict_process *dict_process;
 
 static void dict_process_unlisten(struct dict_process *process);
 
@@ -181,7 +181,9 @@ dict_process_destroyed(struct child_process *process,
 
 void dict_process_init(void)
 {
-       process = i_new(struct dict_process, 1);
+       struct dict_process *process;
+
+       process = dict_process = i_new(struct dict_process, 1);
        process->process.type = PROCESS_TYPE_DICT;
        process->fd = -1;
        process->path = i_strconcat(settings_root->defaults->base_dir,
@@ -194,6 +196,8 @@ void dict_process_init(void)
 
 void dict_process_deinit(void)
 {
+       struct dict_process *process = dict_process;
+
        dict_process_unlisten(process);
        if (process->log != NULL)
                log_unref(process->log);
@@ -203,6 +207,8 @@ void dict_process_deinit(void)
 
 void dict_process_kill(void)
 {
+       struct dict_process *process = dict_process;
+
        if (process->log != NULL) {
                log_unref(process->log);
                process->log = NULL;
index 33c1053921ed706e30f4c88421ccf6708dcdc459..38dc5ca3562e9c5da072d6538bfa74b5fc822742 100644 (file)
@@ -130,7 +130,7 @@ static void check_conflicts(const struct ip_addr *ip, unsigned int port,
 }
 
 static void
-listener_init(const char *set_name, const char *listen,
+listener_init(const char *set_name, const char *listen_list,
              unsigned int default_port, ARRAY_TYPE(listener) *listens_arr)
 {
        const char *const *tmp;
@@ -148,7 +148,7 @@ listener_init(const char *set_name, const char *listen,
        l.fd = -1;
        l.wanted = TRUE;
 
-       for (tmp = t_strsplit_spaces(listen, ", "); *tmp != NULL; tmp++) {
+       for (tmp = t_strsplit_spaces(listen_list, ", "); *tmp != NULL; tmp++) {
                l.port = default_port;
                resolve_ip(set_name, *tmp, &l.ip, &l.port);
 
@@ -204,7 +204,7 @@ static void listen_parse_and_close_unneeded(struct settings *set)
 {
        const char *const *proto;
        unsigned int default_port;
-       bool listen = FALSE, ssl_listen = FALSE;
+       bool nonssl_listen = FALSE, ssl_listen = FALSE;
 
        if (set == NULL)
                return;
@@ -214,14 +214,14 @@ static void listen_parse_and_close_unneeded(struct settings *set)
        for (; *proto != NULL; proto++) {
                if (strcasecmp(*proto, "imap") == 0) {
                        if (set->protocol == MAIL_PROTOCOL_IMAP)
-                               listen = TRUE;
+                               nonssl_listen = TRUE;
                } else if (strcasecmp(*proto, "imaps") == 0) {
                        if (set->protocol == MAIL_PROTOCOL_IMAP &&
                            !set->ssl_disable)
                                ssl_listen = TRUE;
                } else if (strcasecmp(*proto, "pop3") == 0) {
                        if (set->protocol == MAIL_PROTOCOL_POP3)
-                               listen = TRUE;
+                               nonssl_listen = TRUE;
                } else if (strcasecmp(*proto, "pop3s") == 0) {
                        if (set->protocol == MAIL_PROTOCOL_POP3 &&
                            !set->ssl_disable)
@@ -229,7 +229,7 @@ static void listen_parse_and_close_unneeded(struct settings *set)
                }
        }
 
-       if (!listen)
+       if (!nonssl_listen)
                listener_close_fds(&set->listens);
        else {
                default_port = set->protocol == MAIL_PROTOCOL_IMAP ? 143 : 110;
index c82a05bd084c7e35562f620496d4bffa4d4f4b7c..c9b4878401fa0c2444824ae44bb47eef5e80718b 100644 (file)
@@ -519,7 +519,7 @@ static void nfs_warn_if_found(const char *mail, const char *full_home_dir)
 
 enum master_login_status
 create_mail_process(enum process_type process_type, struct settings *set,
-                   int socket, const struct ip_addr *local_ip,
+                   int socket_fd, const struct ip_addr *local_ip,
                    const struct ip_addr *remote_ip,
                    const char *user, const char *const *args,
                    bool dump_capability)
@@ -536,7 +536,7 @@ create_mail_process(enum process_type process_type, struct settings *set,
        gid_t gid;
        ARRAY_DEFINE(extra_args, const char *);
        unsigned int i, len, count, left, process_count, throttle;
-       int ret, log_fd, nice, chdir_errno;
+       int ret, log_fd, nice_value, chdir_errno;
        bool home_given, nfs_check;
 
        i_assert(process_type == PROCESS_TYPE_IMAP ||
@@ -558,7 +558,7 @@ create_mail_process(enum process_type process_type, struct settings *set,
 
        t_array_init(&extra_args, 16);
        mail = home_dir = chroot_dir = system_user = "";
-       uid = (uid_t)-1; gid = (gid_t)-1; nice = 0;
+       uid = (uid_t)-1; gid = (gid_t)-1; nice_value = 0;
        home_given = FALSE;
        for (; *args != NULL; args++) {
                if (strncmp(*args, "home=", 5) == 0) {
@@ -569,7 +569,7 @@ create_mail_process(enum process_type process_type, struct settings *set,
                else if (strncmp(*args, "chroot=", 7) == 0)
                        chroot_dir = *args + 7;
                else if (strncmp(*args, "nice=", 5) == 0)
-                       nice = atoi(*args + 5);
+                       nice_value = atoi(*args + 5);
                else if (strncmp(*args, "system_user=", 12) == 0)
                        system_user = *args + 12;
                else if (strncmp(*args, "uid=", 4) == 0) {
@@ -705,9 +705,9 @@ create_mail_process(enum process_type process_type, struct settings *set,
        }
 
 #ifdef HAVE_SETPRIORITY
-       if (nice != 0) {
-               if (setpriority(PRIO_PROCESS, 0, nice) < 0)
-                       i_error("setpriority(%d) failed: %m", nice);
+       if (nice_value != 0) {
+               if (setpriority(PRIO_PROCESS, 0, nice_value) < 0)
+                       i_error("setpriority(%d) failed: %m", nice_value);
        }
 #endif
 
@@ -720,9 +720,9 @@ create_mail_process(enum process_type process_type, struct settings *set,
        child_process_init_env();
 
        /* move the client socket into stdin and stdout fds, log to stderr */
-       if (dup2(dump_capability ? null_fd : socket, 0) < 0)
+       if (dup2(dump_capability ? null_fd : socket_fd, 0) < 0)
                i_fatal("dup2(stdin) failed: %m");
-       if (dup2(socket, 1) < 0)
+       if (dup2(socket_fd, 1) < 0)
                i_fatal("dup2(stdout) failed: %m");
        if (dup2(log_fd, 2) < 0)
                i_fatal("dup2(stderr) failed: %m");
index 91b0e9197c04b5339903e6d94f60dedcb9aaa77e..98c187e21a26db39dd708ec31ad958743cb18953 100644 (file)
@@ -10,7 +10,7 @@ void mail_process_exec(const char *protocol, const char **args) ATTR_NORETURN;
 
 enum master_login_status
 create_mail_process(enum process_type process_type, struct settings *set,
-                   int socket, const struct ip_addr *local_ip,
+                   int socket_fd, const struct ip_addr *local_ip,
                    const struct ip_addr *remote_ip,
                    const char *user, const char *const *args,
                    bool dump_capability);
index c3211781b2397ba4c9d2c5c31a3585b5e7fb823e..a4a47d422c8b9b4e7f40038562af865c5964d6d1 100644 (file)
@@ -1650,7 +1650,7 @@ static void auth_settings_dump(struct auth_settings *auth, bool nondefaults)
 {
        const struct auth_passdb_settings *passdb;
        const struct auth_userdb_settings *userdb;
-       const struct auth_socket_settings *socket;
+       const struct auth_socket_settings *socket_set;
        const void *sets[2], *sets2[2];
        const void *empty_defaults;
 
@@ -1682,23 +1682,23 @@ static void auth_settings_dump(struct auth_settings *auth, bool nondefaults)
                                      nondefaults, 4);
                }
 
-               socket = auth->sockets;
-               for (; socket != NULL; socket = socket->next) {
+               socket_set = auth->sockets;
+               for (; socket_set != NULL; socket_set = socket_set->next) {
                        printf("  socket:\n");
-                       sets2[1] = socket;
+                       sets2[1] = socket_set;
                        settings_dump(auth_socket_setting_defs, sets2, NULL, 2,
                                      nondefaults, 4);
 
-                       if (socket->client.used) {
+                       if (socket_set->client.used) {
                                printf("    client:\n");
-                               sets2[1] = &socket->client;
+                               sets2[1] = &socket_set->client;
                                settings_dump(socket_setting_defs, sets2, NULL,
                                              2, nondefaults, 6);
                        }
 
-                       if (socket->master.used) {
+                       if (socket_set->master.used) {
                                printf("    master:\n");
-                               sets2[1] = &socket->master;
+                               sets2[1] = &socket_set->master;
                                settings_dump(socket_setting_defs, sets2, NULL,
                                              2, nondefaults, 6);
                        }
index 802dc7d46a9f2df7e7ee93944413df5182358d50..f283fa9ee8320b6fb71dcf26f6c9dfcda74aa4ab 100644 (file)
@@ -643,17 +643,17 @@ node_split_string(struct squat_trie_build_context *ctx, struct squat_node *node)
 {
        struct squat_node *child;
        unsigned char *str;
-       unsigned int uid, idx, str_len = node->leaf_string_length;
+       unsigned int uid, idx, leafstr_len = node->leaf_string_length;
 
-       i_assert(str_len > 0);
+       i_assert(leafstr_len > 0);
 
        /* make a copy of the leaf string and convert to normal node by
           removing it. */
-       str = t_malloc(str_len);
+       str = t_malloc(leafstr_len);
        if (!NODE_IS_DYNAMIC_LEAF(node))
-               memcpy(str, node->children.static_leaf_string, str_len);
+               memcpy(str, node->children.static_leaf_string, leafstr_len);
        else {
-               memcpy(str, node->children.leaf_string, str_len);
+               memcpy(str, node->children.leaf_string, leafstr_len);
                i_free(node->children.leaf_string);
        }
        node->leaf_string_length = 0;
@@ -671,16 +671,17 @@ node_split_string(struct squat_trie_build_context *ctx, struct squat_node *node)
        }
 
        i_assert(!child->have_sequential && child->children.data == NULL);
-       if (str_len > 1) {
+       if (leafstr_len > 1) {
                /* make the child a leaf string */
-               str_len--;
-               child->leaf_string_length = str_len;
+               leafstr_len--;
+               child->leaf_string_length = leafstr_len;
                if (!NODE_IS_DYNAMIC_LEAF(child)) {
                        memcpy(child->children.static_leaf_string,
-                              str + 1, str_len);
+                              str + 1, leafstr_len);
                } else {
-                       child->children.leaf_string = i_malloc(str_len);
-                       memcpy(child->children.leaf_string, str + 1, str_len);
+                       child->children.leaf_string = i_malloc(leafstr_len);
+                       memcpy(child->children.leaf_string,
+                              str + 1, leafstr_len);
                }
        }
 }
@@ -691,10 +692,10 @@ node_leaf_string_add_or_split(struct squat_trie_build_context *ctx,
                              const unsigned char *data, unsigned int data_len)
 {
        const unsigned char *str = NODE_LEAF_STRING(node);
-       const unsigned int str_len = node->leaf_string_length;
+       const unsigned int leafstr_len = node->leaf_string_length;
        unsigned int i;
 
-       if (data_len != str_len) {
+       if (data_len != leafstr_len) {
                /* different lengths, can't match */
                T_BEGIN {
                        node_split_string(ctx, node);
@@ -1757,15 +1758,15 @@ squat_trie_lookup_data(struct squat_trie *trie, const unsigned char *data,
                                return -1;
                }
                if (node->leaf_string_length != 0) {
-                       unsigned int str_len = node->leaf_string_length;
+                       unsigned int len = node->leaf_string_length;
                        const unsigned char *str;
 
-                       if (str_len > sizeof(node->children.static_leaf_string))
+                       if (len > sizeof(node->children.static_leaf_string))
                                str = node->children.leaf_string;
                        else
                                str = node->children.static_leaf_string;
 
-                       if (size > str_len || memcmp(data, str, size) != 0)
+                       if (size > len || memcmp(data, str, size) != 0)
                                return 0;
 
                        /* match */
index b35f30079c8f9eee44bf7f787e6d810acb8d6c77..5944a20aab69ecbcf06f8c230a68e064c114ff1f 100644 (file)
@@ -203,7 +203,7 @@ static void fs_quota_mount_init(struct fs_quota_root *root,
        /* if there are more unused quota roots, copy this mount to them */
        roots = array_get(&root->root.quota->roots, &count);
        for (i = 0; i < count; i++) {
-               struct fs_quota_root *root = (struct fs_quota_root *)roots[i];
+               root = (struct fs_quota_root *)roots[i];
                if (QUOTA_ROOT_MATCH(root, mount) && root->mount == NULL) {
                        mount->refcount++;
                        root->mount = mount;
index 98044472407a4afa25105b627be73168bb28ef93..0144f7cdcb156ff20551e085a08d4873d7057524 100644 (file)
@@ -21,12 +21,12 @@ struct dbox_index_header {
        uint32_t last_dirty_flush_stamp;
 };
 
-static const char *unixdate2str(time_t time)
+static const char *unixdate2str(time_t timestamp)
 {
        static char buf[64];
        struct tm *tm;
 
-       tm = localtime(&time);
+       tm = localtime(&timestamp);
        strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M", tm);
        return buf;
 }
index f8219a44010e020ac7bec7ef7f444bdb2107a783..2060bd2babf408f4253e17142311091766359771 100644 (file)
@@ -274,15 +274,15 @@ rawlog_proxy_create(int client_in_fd, int client_out_fd, int server_fd,
 
 static void rawlog_open(enum rawlog_flags flags)
 {
-       const char *chroot, *home, *path;
+       const char *chroot_dir, *home, *path;
        struct stat st;
        int sfd[2];
        pid_t pid;
 
-       chroot = getenv("RESTRICT_CHROOT");
+       chroot_dir = getenv("RESTRICT_CHROOT");
        home = getenv("HOME");
-       if (chroot != NULL)
-               home = t_strconcat(chroot, home, NULL);
+       if (chroot_dir != NULL)
+               home = t_strconcat(chroot_dir, home, NULL);
        else if (home == NULL)
                home = ".";
 
@@ -296,9 +296,9 @@ static void rawlog_open(enum rawlog_flags flags)
        if (!S_ISDIR(st.st_mode))
                return;
 
-       if (chroot != NULL) {
+       if (chroot_dir != NULL) {
                /* we'll chroot soon. skip over the chroot in the path. */
-               path += strlen(chroot);
+               path += strlen(chroot_dir);
        }
 
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0)