Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/miscutils/last.c


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/miscutils/last.c

    r3232 r3621  
    3333#if defined UT_LINESIZE \
    3434    && ((UT_LINESIZE != 32) || (UT_NAMESIZE != 32) || (UT_HOSTSIZE != 256))
    35 #error struct utmp member char[] size(s) have changed!
     35#error struct utmpx member char[] size(s) have changed!
    3636#elif defined __UT_LINESIZE \
    37     && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 64) || (__UT_HOSTSIZE != 256))
    38 #error struct utmp member char[] size(s) have changed!
     37    && ((__UT_LINESIZE != 32) || (__UT_NAMESIZE != 32) || (__UT_HOSTSIZE != 256))
     38/* __UT_NAMESIZE was checked with 64 above, but glibc-2.11 definitely uses 32! */
     39#error struct utmpx member char[] size(s) have changed!
    3940#endif
    4041
    4142#if EMPTY != 0 || RUN_LVL != 1 || BOOT_TIME != 2 || NEW_TIME != 3 || \
    4243    OLD_TIME != 4
    43 #error Values for the ut_type field of struct utmp changed
     44#error Values for the ut_type field of struct utmpx changed
    4445#endif
    4546
     
    4748int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
    4849{
    49     struct utmp ut;
     50    struct utmpx ut;
    5051    int n, file = STDIN_FILENO;
    5152    time_t t_tmp;
     
    8889                ut.ut_type = n != 3 ? n : SHUTDOWN_TIME;
    8990#else
    90             if (strncmp(ut.ut_user, "shutdown", 8) == 0)
     91            if (is_prefixed_with(ut.ut_user, "shutdown"))
    9192                ut.ut_type = SHUTDOWN_TIME;
    92             else if (strncmp(ut.ut_user, "reboot", 6) == 0)
     93            else if (is_prefixed_with(ut.ut_user, "reboot"))
    9394                ut.ut_type = BOOT_TIME;
    94             else if (strncmp(ut.ut_user, "runlevel", 8) == 0)
     95            else if (is_prefixed_with(ut.ut_user, "runlevel"))
    9596                ut.ut_type = RUN_LVL;
    9697#endif
Note: See TracChangeset for help on using the changeset viewer.