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

Commit 1f7aabf6 authored by Elliott Hughes's avatar Elliott Hughes Committed by Android Git Automerger
Browse files

am 14a13732: am 227f8bf1: Merge "Clean up adb Win32 symlink #ifdefs."

* commit '14a13732':
  Clean up adb Win32 symlink #ifdefs.
parents 8b908a5e 14a13732
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -309,7 +309,9 @@ static int write_data_buffer(int fd, char* file_buffer, int size, syncsendbuf *s
    return err;
}

#ifdef HAVE_SYMLINKS
#if defined(_WIN32)
extern int write_data_link(int fd, const char *path, syncsendbuf *sbuf) __attribute__((error("no symlinks on Windows")));
#else
static int write_data_link(int fd, const char *path, syncsendbuf *sbuf)
{
    int len, ret;
@@ -364,10 +366,8 @@ static int sync_send(int fd, const char *lpath, const char *rpath,
        free(file_buffer);
    } else if (S_ISREG(mode))
        write_data_file(fd, lpath, sbuf, show_progress);
#ifdef HAVE_SYMLINKS
    else if (S_ISLNK(mode))
        write_data_link(fd, lpath, sbuf);
#endif
    else
        goto fail;

+23 −32
Original line number Diff line number Diff line
@@ -270,7 +270,9 @@ fail:
    return -1;
}

#ifdef HAVE_SYMLINKS
#if defined(_WIN32)
extern int handle_send_link(int s, char *path, char *buffer) __attribute__((error("no symlinks on Windows")));
#else
static int handle_send_link(int s, char *path, char *buffer)
{
    syncmsg msg;
@@ -321,25 +323,20 @@ static int handle_send_link(int s, char *path, char *buffer)

    return 0;
}
#endif /* HAVE_SYMLINKS */
#endif

static int do_send(int s, char *path, char *buffer)
{
    char *tmp;
    unsigned int mode;
    int is_link, ret;
    bool is_link = false;
    bool do_unlink;

    tmp = strrchr(path,',');
    char* tmp = strrchr(path,',');
    if(tmp) {
        *tmp = 0;
        errno = 0;
        mode = strtoul(tmp + 1, NULL, 0);
#ifndef HAVE_SYMLINKS
        is_link = 0;
#else
        is_link = S_ISLNK((mode_t) mode);
#endif
        mode &= 0777;
    }
    if(!tmp || errno) {
@@ -355,13 +352,10 @@ static int do_send(int s, char *path, char *buffer)
        }
    }

#ifdef HAVE_SYMLINKS
    if(is_link)
        ret = handle_send_link(s, path, buffer);
    else {
#else
    {
#endif
    if (is_link) {
        return handle_send_link(s, path, buffer);
    }

    uid_t uid = -1;
    gid_t gid = -1;
    uint64_t cap = 0;
@@ -377,10 +371,7 @@ static int do_send(int s, char *path, char *buffer)
    if (is_on_system(path) || is_on_vendor(path)) {
        fs_config(tmp, 0, &uid, &gid, &mode, &cap);
    }
        ret = handle_send_file(s, path, uid, gid, mode, buffer, do_unlink);
    }

    return ret;
    return handle_send_file(s, path, uid, gid, mode, buffer, do_unlink);
}

static int do_recv(int s, const char *path, char *buffer)