Changeset 132 for trunk/src/sh_hash.c


Ignore:
Timestamp:
Oct 23, 2007, 11:44:41 PM (12 years ago)
Author:
rainer
Message:

Make utility functions thread-safe.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_hash.c

    r131 r132  
    14041404
    14051405  char   timestring[81];
    1406   char * timep;
    14071406
    14081407#if !defined(__linux__) && !defined(HAVE_STAT_FLAGS)
     
    17061705                            sl_strlen(sh_db_version_string));
    17071706                  sl_write (pushdata_fd, _(" Date "), 6);
    1708                   timep = sh_unix_time(0);
    1709                   sl_strlcpy(timestring, timep, sizeof(timestring));
     1707                  (void) sh_unix_time(0, timestring, sizeof(timestring));
    17101708                  sl_write (pushdata_fd, timestring, sl_strlen(timestring));
    17111709                  sl_write (pushdata_fd,        "\n", 1);
     
    17161714                  printf ("%s", sh_db_version_string);
    17171715                  printf (_(" Date "));
    1718                   timep = sh_unix_time(0);
    1719                   sl_strlcpy(timestring, timep, sizeof(timestring));
     1716                  (void) sh_unix_time(0, timestring, sizeof(timestring));
    17201717                  printf ("%s\n", timestring);
    17211718                }
     
    23432340
    23442341
    2345   sl_strlcpy (timstr1c, sh_unix_gmttime (theFile->ctime),   32);
     2342  (void) sh_unix_gmttime (theFile->ctime, timstr1c,  sizeof(timstr1c));
    23462343  if (is_new)
    23472344    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_new=\"%s\" "), timstr1c);
     
    23502347  sl_strlcat(msg, tmp, SH_BUFSIZE);
    23512348
    2352   sl_strlcpy (timstr1a, sh_unix_gmttime (theFile->atime),   32);
     2349  (void) sh_unix_gmttime (theFile->atime, timstr1a,  sizeof(timstr1a));
    23532350  if (is_new)
    23542351    sl_snprintf(tmp, SH_BUFSIZE, _("atime_new=\"%s\" "), timstr1a);
     
    23572354  sl_strlcat(msg, tmp, SH_BUFSIZE);
    23582355
    2359   sl_strlcpy (timstr1m, sh_unix_gmttime (theFile->mtime),   32);
     2356  (void) sh_unix_gmttime (theFile->mtime, timstr1m,  sizeof(timstr1m));
    23602357  if (is_new)
    23612358    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_new=\"%s\" "), timstr1m);
     
    25092506
    25102507
    2511   sl_strlcpy (timstr1c, sh_unix_gmttime (theFile->ctime),   32);
     2508  (void) sh_unix_gmttime (theFile->ctime, timstr1c,  sizeof(timstr1c));
    25122509  if (is_new)
    25132510    sl_snprintf(tmp, SH_BUFSIZE, _("ctime_new=<%s>, "), timstr1c);
     
    25162513  sl_strlcat(msg, tmp, SH_BUFSIZE);
    25172514
    2518   sl_strlcpy (timstr1a, sh_unix_gmttime (theFile->atime),   32);
     2515  (void) sh_unix_gmttime (theFile->atime, timstr1a,  sizeof(timstr1a));
    25192516  if (is_new)
    25202517    sl_snprintf(tmp, SH_BUFSIZE, _("atime_new=<%s>, "), timstr1a);
     
    25232520  sl_strlcat(msg, tmp, SH_BUFSIZE);
    25242521
    2525   sl_strlcpy (timstr1m, sh_unix_gmttime (theFile->mtime),   32);
     2522  (void) sh_unix_gmttime (theFile->mtime, timstr1m,  sizeof(timstr1m));
    25262523  if (is_new)
    25272524    sl_snprintf(tmp, SH_BUFSIZE, _("mtime_new=<%s>, "), timstr1m);
     
    31453142      if ((modi_mask & MODI_CTM) != 0)
    31463143        {
    3147           sl_strlcpy (timstr1c, sh_unix_gmttime (p->theFile.ctime), 32);
    3148           sl_strlcpy (timstr2c, sh_unix_gmttime (theFile->ctime),   32);
     3144          (void) sh_unix_gmttime (p->theFile.ctime, timstr1c, sizeof(timstr1c));
     3145          (void) sh_unix_gmttime (theFile->ctime,   timstr2c, sizeof(timstr2c));
    31493146#ifdef SH_USE_XML
    31503147          sl_snprintf(tmp, SH_BUFSIZE, _("ctime_old=\"%s\" ctime_new=\"%s\" "),
     
    31633160      if ((modi_mask & MODI_ATM) != 0)
    31643161        {
    3165           sl_strlcpy (timstr1a, sh_unix_gmttime (p->theFile.atime), 32);
    3166           sl_strlcpy (timstr2a, sh_unix_gmttime (theFile->atime),   32);
     3162          (void) sh_unix_gmttime (p->theFile.atime, timstr1a, sizeof(timstr1a));
     3163          (void) sh_unix_gmttime (theFile->atime,   timstr2a, sizeof(timstr2a));
    31673164#ifdef SH_USE_XML
    31683165          sl_snprintf(tmp, SH_BUFSIZE, _("atime_old=\"%s\" atime_new=\"%s\" "),
     
    31813178      if ((modi_mask & MODI_MTM) != 0)
    31823179        {
    3183           sl_strlcpy (timstr1m, sh_unix_gmttime (p->theFile.mtime), 32);
    3184           sl_strlcpy (timstr2m, sh_unix_gmttime (theFile->mtime),   32);
     3180          (void) sh_unix_gmttime (p->theFile.mtime, timstr1m, sizeof(timstr1m));
     3181          (void) sh_unix_gmttime (theFile->mtime,   timstr2m, sizeof(timstr2m));
    31853182#ifdef SH_USE_XML
    31863183          sl_snprintf(tmp, SH_BUFSIZE, _("mtime_old=\"%s\" mtime_new=\"%s\" "),
     
    35793576
    35803577  if ('c' == p->theFile.c_mode[0] || 'b' == p->theFile.c_mode[0])
    3581     sl_snprintf(str, 80, "%"PRIu64, p->theFile.rdev);
    3582   else
    3583     sl_snprintf(str, 80, "%"PRIu64, p->theFile.size);
     3578    sl_snprintf(str, sizeof(str), "%"PRIu64, p->theFile.rdev);
     3579  else
     3580    sl_snprintf(str, sizeof(str), "%"PRIu64, p->theFile.size);
    35843581
    35853582  printf( _(" %8s"), str);
     
    35873584    putchar(',');
    35883585
    3589   printf( _(" %s"), sh_unix_gmttime (p->theFile.ctime));
     3586  printf( _(" %s"), sh_unix_gmttime (p->theFile.ctime, str, sizeof(str)));
    35903587  if (ListWithDelimiter == S_TRUE)
    35913588    putchar(',');
    3592   printf( _(" %s"), sh_unix_gmttime (p->theFile.mtime));
     3589  printf( _(" %s"), sh_unix_gmttime (p->theFile.mtime, str, sizeof(str)));
    35933590  if (ListWithDelimiter == S_TRUE)
    35943591    putchar(',');
    3595   printf( _(" %s"), sh_unix_gmttime (p->theFile.atime));
     3592  printf( _(" %s"), sh_unix_gmttime (p->theFile.atime, str, sizeof(str)));
    35963593  if (ListWithDelimiter == S_TRUE)
    35973594    putchar(',');
Note: See TracChangeset for help on using the changeset viewer.