Changeset 154


Ignore:
Timestamp:
Jan 12, 2008, 7:04:06 PM (17 years ago)
Author:
katerina
Message:

Fix more compiler warnings, and a potential NULL dereference in the unix entropy collector.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Changelog

    r153 r154  
    112.4.2:
     2        * fix more compiler warnings, and a potential (compiler-dependent)
     3          NULL dereference in the unix entropy collector
    24        * fix some compiler warnings
    35        * use -D_FORTIFY_SOURCE=1 -fstack-protector-all instead
  • trunk/src/sh_entropy.c

    r153 r154  
    771771  i = 0;
    772772
    773   while (source[i].command != NULL) {
     773  while (source_template[i].command != NULL) {
    774774
    775775    j = 0;
  • trunk/src/sh_mem.c

    r153 r154  
    261261{
    262262  volatile memlist_t * this   = memlist;
    263   memlist_t          * before = memlist;
     263  volatile memlist_t * before = memlist;
    264264  unsigned long        size   = 0;
    265265
     
    315315  free(a);
    316316  if (this)
    317     free(this);
     317    free((void*)this);
    318318  ++Free_Count;
    319319  --Now_Alloc_Count;
  • trunk/src/sh_unix.c

    r153 r154  
    551551#endif
    552552{
     553#if defined(SL_DEBUG)
     554  int retval;
     555#endif
     556
    553557#if defined(SA_SIGACTION_WORKS)
    554558  if (signal_info != NULL && signal_info->si_code == SI_USER)
     
    586590#endif
    587591      safe_logger (mysignal, 0, NULL);
    588       chdir ("/");
     592      do {
     593        retval = chdir ("/");
     594      } while (retval < 0 && errno == EINTR);
    589595      raise(SIGFPE);
    590596    }
    591597  else if (immediate_exit_fast == 2)
    592598    {
    593       chdir ("/");
     599      do {
     600        retval = chdir ("/");
     601      } while (retval < 0 && errno == EINTR);
    594602      raise(SIGFPE);
    595603    }
     
    624632#endif
    625633
    626   chdir ("/");
     634  do {
     635    retval = chdir ("/");
     636  } while (retval < 0 && errno == EINTR);
     637
    627638  raise(SIGFPE);
    628639#endif
  • trunk/src/sh_utmp.c

    r153 r154  
    771771#endif
    772772
     773/* These variables are not used anywhere. They only exist
     774 * to assign &userold, &user to them, which keeps gcc from
     775 * putting them into a register, and avoids the 'clobbered
     776 * by longjmp' warning. And no, 'volatile' proved insufficient.
     777 */
     778void * sh_dummy_userold = NULL;
     779void * sh_dummy_user    = NULL;
     780
     781
    773782static void sh_utmp_addlogin (struct SH_UTMP_S * ut)
    774783{
    775   struct          log_user   * user     = userlist;
    776   volatile struct log_user   * userold  = userlist;
     784  struct log_user   * user     = userlist;
     785  struct log_user   * userold  = userlist;
    777786#ifdef HAVE_UTTYPE 
    778787  struct log_user   * username = userlist;
     
    785794
    786795  SL_ENTER(_("sh_utmp_addlogin"));
     796
     797  /* Take the address to keep gcc from putting them into registers.
     798   * Avoids the 'clobbered by longjmp' warning.
     799   */
     800  sh_dummy_userold = (void*) &userold;
     801  sh_dummy_user    = (void*) &user;
    787802
    788803  if (ut->ut_line[0] == '\0')
     
    804819  while (user != NULL)
    805820    {
    806       if (0 == sl_strncmp(user->ut_tty, ut->ut_line, UT_LINESIZE) )
     821      if (0 == sl_strncmp((char*)(user->ut_tty), ut->ut_line, UT_LINESIZE) )
    807822        break;
    808823      userold = user;
     
    827842          user = SH_ALLOC(sizeof(struct log_user));
    828843          user->next       = userlist;
    829           userlist         = user;
     844          userlist         = (struct log_user *) user;
    830845        }
    831       (void) sl_strlcpy(user->ut_tty,  ut->ut_line, UT_LINESIZE+1);
    832       (void) sl_strlcpy(user->name,    ut->ut_name, UT_NAMESIZE+1);
     846      (void) sl_strlcpy((char*)(user->ut_tty),  ut->ut_line, UT_LINESIZE+1);
     847      (void) sl_strlcpy((char*)(user->name),    ut->ut_name, UT_NAMESIZE+1);
    833848#ifdef HAVE_UTHOST
    834       (void) sl_strlcpy(user->ut_host, ut->ut_host, UT_HOSTSIZE+1);
     849      (void) sl_strlcpy((char*)(user->ut_host), ut->ut_host, UT_HOSTSIZE+1);
    835850#else
    836851      user->ut_host[0] = '\0';
     
    838853#ifdef HAVE_UTADDR
    839854      /*@-type@*//* ut_addr does exist !!! */
    840       (void) sl_strlcpy(user->ut_ship,
     855      (void) sl_strlcpy((char*)(user->ut_ship),
    841856                        my_inet_ntoa(*(struct in_addr*)&(ut->ut_addr)), 16);
    842857      /*@+type@*/
     
    848863          || 0 == sl_strncmp(ut->ut_line, _("ttyq"), 4) /* in virt. console  */
    849864          ) {
    850         status = sh_utmp_login_a(user->name);
     865        status = sh_utmp_login_a((char*)user->name);
    851866        SH_MUTEX_LOCK(mutex_thread_nolog);
    852867        (void) sh_unix_time (user->time, ttt, TIM_MAX);
     
    872887        SH_MUTEX_UNLOCK(mutex_thread_nolog);
    873888      } else
    874         if (0 != sh_utmp_is_virtual(ut->ut_line, user->ut_host))
     889        if (0 != sh_utmp_is_virtual(ut->ut_line, (char*)user->ut_host))
    875890          {       
    876             status = sh_utmp_login_a(user->name);
     891            status = sh_utmp_login_a((char*)user->name);
    877892            SH_MUTEX_LOCK(mutex_thread_nolog);
    878893            (void) sh_unix_time (user->time, ttt, TIM_MAX);
     
    911926      if (user != NULL)
    912927        {
    913           status = sh_utmp_login_r(user->name);
     928          status = sh_utmp_login_r((char*)user->name);
    914929          SH_MUTEX_LOCK(mutex_thread_nolog);
    915930          (void) sh_unix_time (ut->ut_time, ttt, TIM_MAX);
     
    937952          if (user == userlist)
    938953            userlist = user->next;
    939           sh_utmp_logout_morechecks(user);
    940           SH_FREE(user);
     954          sh_utmp_logout_morechecks((struct log_user *)user);
     955          SH_FREE((struct log_user *)user);
    941956          user = NULL;
    942957        }
Note: See TracChangeset for help on using the changeset viewer.