Changeset 383 for trunk/src/sh_utmp.c


Ignore:
Timestamp:
Dec 5, 2011, 10:30:33 PM (13 years ago)
Author:
katerina
Message:

Fix for ticket #281 (warnings from clang static analyzer).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_utmp.c

    r363 r383  
    872872  SL_ENTER(_("sh_utmp_addlogin"));
    873873
     874  if (ut->ut_line[0] == '\0')
     875    SL_RET0(_("sh_utmp_addlogin"));
     876
     877  /* for some stupid reason, AIX repeats the wtmp entry for logouts
     878   * with ssh
     879   */
     880  if (memcmp (&save_utmp, ut, sizeof(struct SH_UTMP_S)) == 0)
     881    {
     882      memset(&save_utmp, (int) '\0', sizeof(struct SH_UTMP_S));
     883      SL_RET0(_("sh_utmp_addlogin"));
     884    }
     885  memcpy (&save_utmp, ut, sizeof(struct SH_UTMP_S));
     886
    874887  /* Take the address to keep gcc from putting them into registers.
    875888   * Avoids the 'clobbered by longjmp' warning.
     
    877890  sh_dummy_userold = (void*) &userold;
    878891  sh_dummy_user    = (void*) &user;
    879 
    880   if (ut->ut_line[0] == '\0')
    881     SL_RET0(_("sh_utmp_addlogin"));
    882 
    883   /* for some stupid reason, AIX repeats the wtmp entry for logouts
    884    * with ssh
    885    */
    886   if (memcmp (&save_utmp, ut, sizeof(struct SH_UTMP_S)) == 0)
    887     {
    888       memset(&save_utmp, (int) '\0', sizeof(struct SH_UTMP_S));
    889       SL_RET0(_("sh_utmp_addlogin"));
    890     }
    891   memcpy (&save_utmp, ut, sizeof(struct SH_UTMP_S));
    892 
    893892
    894893  /* ------- find user --------
     
    993992     
    994993      sh_utmp_login_morechecks(ut);
    995       SL_RET0(_("sh_utmp_addlogin"));
     994      goto out;
    996995    }
    997996
     
    10521051          SH_MUTEX_UNLOCK(mutex_thread_nolog);
    10531052        }
    1054       SL_RET0(_("sh_utmp_addlogin"));
     1053      goto out;
    10551054    }
    10561055
    10571056  /* default */
    1058   SL_RET0(_("sh_utmp_addlogin"));
     1057  goto out;
    10591058
    10601059  /* #ifdef HAVE_UTTYPE                   */
     
    11361135    }
    11371136
     1137#endif
     1138
     1139 out:
     1140  sh_dummy_user    = NULL;
     1141  sh_dummy_userold = NULL;
     1142
    11381143  SL_RET0(_("sh_utmp_addlogin"));
    1139 #endif
    11401144}
    11411145
     
    12141218    {
    12151219      while (this_read < lastread) {
    1216         ut = sh_utmp_getutent();
     1220        (void) sh_utmp_getutent();
    12171221        ++this_read;
    12181222      }
Note: See TracChangeset for help on using the changeset viewer.