Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4894f4b authored by Mike Lockwood's avatar Mike Lockwood Committed by Android Git Automerger
Browse files

am 034117e4: Merge changes I8df51128,Ie922b3e7,I31f78419,I7e8df44d,I6067857b,Ifd35587c,Ie8d66740

* commit '034117e4':
  Fix adb leaking file descriptors to forked processes
  adb: Fix command-line parser.
  adb: Increase device descriptor buffer size in Linux host USB support
  adb: improve debug traces readability.
  adb: Don't report negative number of bytes after pushing file > 2 gigabytes
  Adding Texas Instruments to the VID list.
  Support an additional alias for 'adb shell.'
parents 63e70b24 034117e4
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -682,9 +682,11 @@ void start_device_log(void)
    dup2(fd, 1);
    dup2(fd, 1);
    dup2(fd, 2);
    dup2(fd, 2);
    fprintf(stderr,"--- adb starting (pid %d) ---\n", getpid());
    fprintf(stderr,"--- adb starting (pid %d) ---\n", getpid());
    adb_close(fd);


    fd = unix_open("/dev/null", O_RDONLY);
    fd = unix_open("/dev/null", O_RDONLY);
    dup2(fd, 0);
    dup2(fd, 0);
    adb_close(fd);
}
}
#endif
#endif


@@ -1266,8 +1268,8 @@ int recovery_mode = 0;


int main(int argc, char **argv)
int main(int argc, char **argv)
{
{
    adb_trace_init();
#if ADB_HOST
#if ADB_HOST
    adb_trace_init();
    adb_sysdeps_init();
    adb_sysdeps_init();
    return adb_commandline(argc - 1, argv + 1);
    return adb_commandline(argc - 1, argv + 1);
#else
#else
+23 −4
Original line number Original line Diff line number Diff line
@@ -683,6 +683,7 @@ int adb_commandline(int argc, char **argv)
    char buf[4096];
    char buf[4096];
    int no_daemon = 0;
    int no_daemon = 0;
    int is_daemon = 0;
    int is_daemon = 0;
    int is_server = 0;
    int persist = 0;
    int persist = 0;
    int r;
    int r;
    int quote;
    int quote;
@@ -719,7 +720,9 @@ int adb_commandline(int argc, char **argv)


    /* modifiers and flags */
    /* modifiers and flags */
    while(argc > 0) {
    while(argc > 0) {
        if(!strcmp(argv[0],"nodaemon")) {
        if(!strcmp(argv[0],"server")) {
            is_server = 1;
        } else if(!strcmp(argv[0],"nodaemon")) {
            no_daemon = 1;
            no_daemon = 1;
        } else if (!strcmp(argv[0], "fork-server")) {
        } else if (!strcmp(argv[0], "fork-server")) {
            /* this is a special flag used only when the ADB client launches the ADB Server */
            /* this is a special flag used only when the ADB client launches the ADB Server */
@@ -766,7 +769,7 @@ int adb_commandline(int argc, char **argv)
    adb_set_transport(ttype, serial);
    adb_set_transport(ttype, serial);
    adb_set_tcp_specifics(server_port);
    adb_set_tcp_specifics(server_port);


    if ((argc > 0) && (!strcmp(argv[0],"server"))) {
    if (is_server) {
        if (no_daemon || is_daemon) {
        if (no_daemon || is_daemon) {
            r = adb_main(is_daemon, server_port);
            r = adb_main(is_daemon, server_port);
        } else {
        } else {
@@ -838,12 +841,24 @@ top:
        return adb_send_emulator_command(argc, argv);
        return adb_send_emulator_command(argc, argv);
    }
    }


    if(!strcmp(argv[0], "shell")) {
    if(!strcmp(argv[0], "shell") || !strcmp(argv[0], "hell")) {
        int r;
        int r;
        int fd;
        int fd;


        char h = (argv[0][0] == 'h');

        if (h) {
            printf("\x1b[41;33m");
            fflush(stdout);
        }

        if(argc < 2) {
        if(argc < 2) {
            return interactive_shell();
            r = interactive_shell();
            if (h) {
                printf("\x1b[0m");
                fflush(stdout);
            }
            return r;
        }
        }


        snprintf(buf, sizeof buf, "shell:%s", argv[1]);
        snprintf(buf, sizeof buf, "shell:%s", argv[1]);
@@ -877,6 +892,10 @@ top:
                adb_sleep_ms(1000);
                adb_sleep_ms(1000);
                do_cmd(ttype, serial, "wait-for-device", 0);
                do_cmd(ttype, serial, "wait-for-device", 0);
            } else {
            } else {
                if (h) {
                    printf("\x1b[0m");
                    fflush(stdout);
                }
                return r;
                return r;
            }
            }
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -57,9 +57,9 @@ static void END()
    if (t == 0)  /* prevent division by 0 :-) */
    if (t == 0)  /* prevent division by 0 :-) */
        t = 1000000;
        t = 1000000;


    fprintf(stderr,"%lld KB/s (%d bytes in %lld.%03llds)\n",
    fprintf(stderr,"%lld KB/s (%lld bytes in %lld.%03llds)\n",
            ((((long long) total_bytes) * 1000000LL) / t) / 1024LL,
            ((((long long) total_bytes) * 1000000LL) / t) / 1024LL,
            total_bytes, (t / 1000000LL), (t % 1000000LL) / 1000LL);
            (long long) total_bytes, (t / 1000000LL), (t % 1000000LL) / 1000LL);
}
}


void sync_quit(int fd)
void sync_quit(int fd)
+1 −0
Original line number Original line Diff line number Diff line
@@ -499,6 +499,7 @@ jdwp_control_init( JdwpControl* control,


    /* only wait for incoming connections */
    /* only wait for incoming connections */
    fdevent_add(control->fde, FDE_READ);
    fdevent_add(control->fde, FDE_READ);
    close_on_exec(s);


    D("jdwp control socket started (%d)\n", control->listen_socket);
    D("jdwp control socket started (%d)\n", control->listen_socket);
    return 0;
    return 0;
+1 −0
Original line number Original line Diff line number Diff line
@@ -309,6 +309,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1
        dup2(pts, 1);
        dup2(pts, 1);
        dup2(pts, 2);
        dup2(pts, 2);


        adb_close(pts);
        adb_close(ptm);
        adb_close(ptm);


        execl(cmd, cmd, arg0, arg1, NULL);
        execl(cmd, cmd, arg0, arg1, NULL);
Loading