Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/utils/net_cache.c

    r414 r740  
    3434 * Both of them are defined by first arg of gencache_iterate() routine.
    3535 */
    36 static void print_cache_entry(const char* keystr, const char* datastr,
     36static void print_cache_entry(const char* keystr, ,
    3737                              const time_t timeout, void* dptr)
    3838{
    3939        char *timeout_str;
    4040        char *alloc_str = NULL;
     41
     42
    4143        time_t now_t = time(NULL);
    42         struct tm timeout_tm, *now_tm;
    43         /* localtime returns statically allocated pointer, so timeout_tm
    44            has to be copied somewhere else */
    45 
    46         now_tm = localtime(&timeout);
    47         if (!now_tm) {
     44        struct tm timeout_tm, now_tm;
     45        struct tm *ptimeout_tm, *pnow_tm;
     46
     47        ptimeout_tm = localtime_r(&timeout, &timeout_tm);
     48        if (ptimeout_tm == NULL) {
    4849                return;
    4950        }
    50         memcpy(&timeout_tm, now_tm, sizeof(struct tm));
    51         now_tm = localtime(&now_t);
    52         if (!now_tm) {
     51        pnow_tm = localtime_r(&now_t, &now_tm);
     52        if (pnow_tm == NULL) {
    5353                return;
    5454        }
    5555
    5656        /* form up timeout string depending whether it's today's date or not */
    57         if (timeout_tm.tm_year != now_tm->tm_year ||
    58                         timeout_tm.tm_mon != now_tm->tm_mon ||
    59                         timeout_tm.tm_mday != now_tm->tm_mday) {
     57        if (timeout_tm.tm_year != now_tmtm_year ||
     58                        timeout_tm.tm_mon != now_tmtm_mon ||
     59                        timeout_tm.tm_mday != now_tmtm_mday) {
    6060
    6161                timeout_str = asctime(&timeout_tm);
     
    7272        }
    7373
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
    7486        d_printf(_("Key: %s\t Timeout: %s\t Value: %s  %s\n"), keystr,
    7587                 timeout_str, datastr, timeout > now_t ? "": _("(expired)"));
     
    221233{
    222234        const char* keystr = argv[0];
    223         char* valuestr = NULL;
     235        ;
    224236        time_t timeout;
    225237
     
    231243        }
    232244
    233         if (gencache_get(keystr, &valuestr, &timeout)) {
    234                 print_cache_entry(keystr, valuestr, timeout, NULL);
    235                 SAFE_FREE(valuestr);
     245        if (gencache_get)) {
     246                print_cache_entry(keystr, value, timeout, NULL);
     247                );
    236248                return 0;
    237249        }
     
    261273
    262274        pattern = argv[0];
    263         gencache_iterate(print_cache_entry, NULL, pattern);
     275        gencache_iterate(print_cache_entry, NULL, pattern);
    264276        return 0;
    265277}
     
    285297                return 0;
    286298        }
    287         gencache_iterate(print_cache_entry, NULL, pattern);
     299        gencache_iterate(print_cache_entry, NULL, pattern);
    288300        return 0;
    289301}
Note: See TracChangeset for help on using the changeset viewer.