static int do_create(struct iovec *iovec)

{

    int ret;

    V9fsString path;

    int flags, mode, uid, gid, cur_uid, cur_gid;



    v9fs_string_init(&path);

    ret = proxy_unmarshal(iovec, PROXY_HDR_SZ, "sdddd",

                          &path, &flags, &mode, &uid, &gid);

    if (ret < 0) {

        goto unmarshal_err_out;

    }

    cur_uid = geteuid();

    cur_gid = getegid();

    ret = setfsugid(uid, gid);

    if (ret < 0) {

        /*

         * On failure reset back to the

         * old uid/gid

         */

        ret = -errno;

        goto err_out;

    }

    ret = open(path.data, flags, mode);

    if (ret < 0) {

        ret = -errno;

    }



err_out:

    setfsugid(cur_uid, cur_gid);

unmarshal_err_out:

    v9fs_string_free(&path);

    return ret;

}

static int do_create(struct iovec *iovec)

{

    int ret;

    V9fsString path;

    int flags, mode, uid, gid, cur_uid, cur_gid;



    v9fs_string_init(&path);

    ret = proxy_unmarshal(iovec, PROXY_HDR_SZ, "sdddd",

                          &path, &flags, &mode, &uid, &gid);

    if (ret < 0) {

        goto unmarshal_err_out;

    }

    cur_uid = geteuid();

    cur_gid = getegid();

    ret = setfsugid(uid, gid);

    if (ret < 0) {

        







        ret = -errno;

        goto err_out;

    }

    ret = open(path.data, flags, mode);

    if (ret < 0) {

        ret = -errno;

    }



err_out:

    setfsugid(cur_uid, cur_gid);

unmarshal_err_out:

    v9fs_string_free(&path);

    return ret;

}

static int FUNC_0(struct VAR_0 *VAR_0)

{

    int VAR_1;

    V9fsString path;

    int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7;



    v9fs_string_init(&path);

    VAR_1 = proxy_unmarshal(VAR_0, PROXY_HDR_SZ, "sdddd",

                          &path, &VAR_2, &VAR_3, &VAR_4, &VAR_5);

    if (VAR_1 < 0) {

        goto unmarshal_err_out;

    }

    VAR_6 = geteuid();

    VAR_7 = getegid();

    VAR_1 = setfsugid(VAR_4, VAR_5);

    if (VAR_1 < 0) {

        







        VAR_1 = -errno;

        goto err_out;

    }

    VAR_1 = open(path.data, VAR_2, VAR_3);

    if (VAR_1 < 0) {

        VAR_1 = -errno;

    }



err_out:

    setfsugid(VAR_6, VAR_7);

unmarshal_err_out:

    v9fs_string_free(&path);

    return VAR_1;

}

static int FUNC_0(struct VAR_0 *VAR_0)
{ int VAR_1; V9fsString path; int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6, VAR_7; v9fs_string_init(&path); VAR_1 = proxy_unmarshal(VAR_0, PROXY_HDR_SZ, "sdddd",
&path, &VAR_2, &VAR_3, &VAR_4, &VAR_5); if (VAR_1 < 0) { goto unmarshal_err_out; } VAR_6 = geteuid(); VAR_7 = getegid(); VAR_1 = setfsugid(VAR_4, VAR_5); if (VAR_1 < 0) { VAR_1 = -errno; goto err_out; } VAR_1 = open(path.data, VAR_2, VAR_3); if (VAR_1 < 0) { VAR_1 = -errno; } err_out:
setfsugid(VAR_6, VAR_7); unmarshal_err_out:
v9fs_string_free(&path); return VAR_1; }