static int do_create_others(int type, struct iovec *iovec)

{

    dev_t rdev;

    int retval = 0;

    int offset = PROXY_HDR_SZ;

    V9fsString oldpath, path;

    int mode, uid, gid, cur_uid, cur_gid;



    v9fs_string_init(&path);

    v9fs_string_init(&oldpath);

    cur_uid = geteuid();

    cur_gid = getegid();



    retval = proxy_unmarshal(iovec, offset, "dd", &uid, &gid);

    if (retval < 0) {

        return retval;

    }

    offset += retval;

    retval = setfsugid(uid, gid);

    if (retval < 0) {

        retval = -errno;

        goto err_out;

    }

    switch (type) {

    case T_MKNOD:

        retval = proxy_unmarshal(iovec, offset, "sdq", &path, &mode, &rdev);

        if (retval < 0) {

            goto err_out;

        }

        retval = mknod(path.data, mode, rdev);

        break;

    case T_MKDIR:

        retval = proxy_unmarshal(iovec, offset, "sd", &path, &mode);

        if (retval < 0) {

            goto err_out;

        }

        retval = mkdir(path.data, mode);

        break;

    case T_SYMLINK:

        retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path);

        if (retval < 0) {

            goto err_out;

        }

        retval = symlink(oldpath.data, path.data);

        break;

    }

    if (retval < 0) {

        retval = -errno;

    }



err_out:

    v9fs_string_free(&path);

    v9fs_string_free(&oldpath);

    setfsugid(cur_uid, cur_gid);

    return retval;

}

static int do_create_others(int type, struct iovec *iovec)

{

    dev_t rdev;

    int retval = 0;

    int offset = PROXY_HDR_SZ;

    V9fsString oldpath, path;

    int mode, uid, gid, cur_uid, cur_gid;



    v9fs_string_init(&path);

    v9fs_string_init(&oldpath);

    cur_uid = geteuid();

    cur_gid = getegid();



    retval = proxy_unmarshal(iovec, offset, "dd", &uid, &gid);

    if (retval < 0) {

        return retval;

    }

    offset += retval;

    retval = setfsugid(uid, gid);

    if (retval < 0) {

        retval = -errno;

        goto err_out;

    }

    switch (type) {

    case T_MKNOD:

        retval = proxy_unmarshal(iovec, offset, "sdq", &path, &mode, &rdev);

        if (retval < 0) {

            goto err_out;

        }

        retval = mknod(path.data, mode, rdev);

        break;

    case T_MKDIR:

        retval = proxy_unmarshal(iovec, offset, "sd", &path, &mode);

        if (retval < 0) {

            goto err_out;

        }

        retval = mkdir(path.data, mode);

        break;

    case T_SYMLINK:

        retval = proxy_unmarshal(iovec, offset, "ss", &oldpath, &path);

        if (retval < 0) {

            goto err_out;

        }

        retval = symlink(oldpath.data, path.data);

        break;

    }

    if (retval < 0) {

        retval = -errno;

    }



err_out:

    v9fs_string_free(&path);

    v9fs_string_free(&oldpath);

    setfsugid(cur_uid, cur_gid);

    return retval;

}

static int FUNC_0(int VAR_0, struct VAR_1 *VAR_1)

{

    dev_t rdev;

    int VAR_2 = 0;

    int VAR_3 = PROXY_HDR_SZ;

    V9fsString oldpath, path;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;



    v9fs_string_init(&path);

    v9fs_string_init(&oldpath);

    VAR_7 = geteuid();

    VAR_8 = getegid();



    VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "dd", &VAR_5, &VAR_6);

    if (VAR_2 < 0) {

        return VAR_2;

    }

    VAR_3 += VAR_2;

    VAR_2 = setfsugid(VAR_5, VAR_6);

    if (VAR_2 < 0) {

        VAR_2 = -errno;

        goto err_out;

    }

    switch (VAR_0) {

    case T_MKNOD:

        VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "sdq", &path, &VAR_4, &rdev);

        if (VAR_2 < 0) {

            goto err_out;

        }

        VAR_2 = mknod(path.data, VAR_4, rdev);

        break;

    case T_MKDIR:

        VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "sd", &path, &VAR_4);

        if (VAR_2 < 0) {

            goto err_out;

        }

        VAR_2 = mkdir(path.data, VAR_4);

        break;

    case T_SYMLINK:

        VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "ss", &oldpath, &path);

        if (VAR_2 < 0) {

            goto err_out;

        }

        VAR_2 = symlink(oldpath.data, path.data);

        break;

    }

    if (VAR_2 < 0) {

        VAR_2 = -errno;

    }



err_out:

    v9fs_string_free(&path);

    v9fs_string_free(&oldpath);

    setfsugid(VAR_7, VAR_8);

    return VAR_2;

}

static int FUNC_0(int VAR_0, struct VAR_1 *VAR_1)
{ dev_t rdev; int VAR_2 = 0; int VAR_3 = PROXY_HDR_SZ; V9fsString oldpath, path; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; v9fs_string_init(&path); v9fs_string_init(&oldpath); VAR_7 = geteuid(); VAR_8 = getegid(); VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "dd", &VAR_5, &VAR_6); if (VAR_2 < 0) { return VAR_2; } VAR_3 += VAR_2; VAR_2 = setfsugid(VAR_5, VAR_6); if (VAR_2 < 0) { VAR_2 = -errno; goto err_out; } switch (VAR_0) { case T_MKNOD:
VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "sdq", &path, &VAR_4, &rdev); if (VAR_2 < 0) { goto err_out; } VAR_2 = mknod(path.data, VAR_4, rdev); break; case T_MKDIR:
VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "sd", &path, &VAR_4); if (VAR_2 < 0) { goto err_out; } VAR_2 = mkdir(path.data, VAR_4); break; case T_SYMLINK:
VAR_2 = proxy_unmarshal(VAR_1, VAR_3, "ss", &oldpath, &path); if (VAR_2 < 0) { goto err_out; } VAR_2 = symlink(oldpath.data, path.data); break; } if (VAR_2 < 0) { VAR_2 = -errno; } err_out:
v9fs_string_free(&path); v9fs_string_free(&oldpath); setfsugid(VAR_7, VAR_8); return VAR_2; }