Changeset 3910 in MondoRescue


Ignore:
Timestamp:
May 8, 2025, 5:24:25 PM (3 months ago)
Author:
Bruno Cornec
Message:

Remove stime usage

based on commit d3539be8f27b8cbfdfee460fe08299158f08bcd9 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair.francis@…>

stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.

Location:
branches/3.3/mindi-busybox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/coreutils/date.c

    r3770 r3910  
    299299
    300300        /* if setting time, set it */
    301         if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
     301        if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
    302302            bb_perror_msg("can't set date");
    303303        }
  • branches/3.3/mindi-busybox/libbb/missing_syscalls.c

    r3621 r3910  
    1515{
    1616    return syscall(__NR_getsid, pid);
    17 }
    18 
    19 int stime(const time_t *t)
    20 {
    21     struct timeval tv;
    22     tv.tv_sec = *t;
    23     tv.tv_usec = 0;
    24     return settimeofday(&tv, NULL);
    2517}
    2618
  • branches/3.3/mindi-busybox/util-linux/rdate.c

    r3621 r3910  
    6868        if (current_time == remote_time)
    6969            bb_error_msg("current time matches remote time");
    70         else
    71             if (stime(&remote_time) < 0)
     70        else {
     71            struct timespec ts;
     72            ts.tv_sec = remote_time;
     73            ts.tv_nsec = 0;
     74            if (clock_settime(CLOCK_REALTIME, &ts) < 0)
    7275                bb_perror_msg_and_die("can't set time of day");
     76        }
    7377    }
    7478
Note: See TracChangeset for help on using the changeset viewer.