Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/miscutils/wall.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/wall.c

    r3232 r3621  
    66 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    77 */
     8
     9//config:config WALL
     10//config:   bool "wall"
     11//config:   default y
     12//config:   depends on FEATURE_UTMP
     13//config:   help
     14//config:     Write a message to all users that are logged in.
     15
     16/* Needs to be run by root or be suid root - needs to write to /dev/TTY: */
     17//applet:IF_WALL(APPLET(wall, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
     18
     19//kbuild:lib-$(CONFIG_WALL) += wall.o
    820
    921//usage:#define wall_trivial_usage
     
    2133int wall_main(int argc UNUSED_PARAM, char **argv)
    2234{
    23     struct utmp *ut;
     35    struct utmpx *ut;
    2436    char *msg;
    25     int fd = argv[1] ? xopen(argv[1], O_RDONLY) : STDIN_FILENO;
     37    int fd;
    2638
     39    fd = STDIN_FILENO;
     40    if (argv[1]) {
     41        /* The applet is setuid.
     42         * Access to the file must be under user's uid/gid.
     43         */
     44        fd = xopen_as_uid_gid(argv[1], O_RDONLY, getuid(), getgid());
     45    }
    2746    msg = xmalloc_read(fd, NULL);
    2847    if (ENABLE_FEATURE_CLEAN_UP && argv[1])
    2948        close(fd);
    30     setutent();
    31     while ((ut = getutent()) != NULL) {
     49    setutxent();
     50    while ((ut = getutxent()) != NULL) {
    3251        char *line;
    3352        if (ut->ut_type != USER_PROCESS)
     
    3857    }
    3958    if (ENABLE_FEATURE_CLEAN_UP) {
    40         endutent();
     59        endutxent();
    4160        free(msg);
    4261    }
Note: See TracChangeset for help on using the changeset viewer.