Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/coreutils/logname.c

    r821 r1765  
    2121 */
    2222
    23 #include <stdio.h>
    24 #include <stdlib.h>
    25 #include <unistd.h>
    26 #include "busybox.h"
     23#include "libbb.h"
    2724
     25/* This is a NOFORK applet. Be very careful! */
     26
     27int logname_main(int argc, char ATTRIBUTE_UNUSED **argv);
    2828int logname_main(int argc, char ATTRIBUTE_UNUSED **argv)
    2929{
    30     const char *p;
     30    char buf[128];
    3131
    3232    if (argc > 1) {
     
    3434    }
    3535
    36     if ((p = getlogin()) != NULL) {
    37         puts(p);
    38         bb_fflush_stdout_and_exit(EXIT_SUCCESS);
     36    /* Using _r function - avoid pulling in static buffer from libc */
     37    if (getlogin_r(buf, sizeof(buf)) == 0) {
     38        puts(buf);
     39        return fflush(stdout);
    3940    }
    4041
Note: See TracChangeset for help on using the changeset viewer.