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/libbb/bb_askpass.c

    r3232 r3621  
    22/*
    33 * Ask for a password
    4  * I use a static buffer in this function.  Plan accordingly.
    54 *
    65 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
     
    2423    /* Was static char[BIGNUM] */
    2524    enum { sizeof_passwd = 128 };
    26     static char *passwd;
    2725
     26    char *passwd;
    2827    char *ret;
    2928    int i;
     
    3130    struct termios tio, oldtio;
    3231
     32    tcflush(fd, TCIFLUSH);
     33    /* Was buggy: was printing prompt *before* flushing input,
     34     * which was upsetting "expect" based scripts of some users.
     35     */
    3336    fputs(prompt, stdout);
    3437    fflush_all();
    35     tcflush(fd, TCIFLUSH);
    3638
    3739    tcgetattr(fd, &oldtio);
     
    6062    }
    6163
    62     if (!passwd)
    63         passwd = xmalloc(sizeof_passwd);
     64    passwd = auto_string(xmalloc(sizeof_passwd));
    6465    ret = passwd;
    6566    i = 0;
    6667    while (1) {
    6768        int r = read(fd, &ret[i], 1);
    68         if (r < 0) {
     69        if ((i == 0 && r == 0) /* EOF (^D) with no password */
     70         || r < 0
     71        ) {
    6972            /* read is interrupted by timeout or ^C */
    7073            ret = NULL;
Note: See TracChangeset for help on using the changeset viewer.