static int handle_update_file_cred(int dirfd, const char *name, FsCred *credp)

{

    int fd, ret;

    fd = openat(dirfd, name, O_NONBLOCK | O_NOFOLLOW);

    if (fd < 0) {

        return fd;

    }

    ret = fchmod(fd, credp->fc_mode & 07777);

    if (ret < 0) {

        goto err_out;

    }

    ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH);

err_out:

    close(fd);

    return ret;

}

static int handle_update_file_cred(int dirfd, const char *name, FsCred *credp)

{

    int fd, ret;

    fd = openat(dirfd, name, O_NONBLOCK | O_NOFOLLOW);

    if (fd < 0) {

        return fd;

    }

    ret = fchmod(fd, credp->fc_mode & 07777);

    if (ret < 0) {

        goto err_out;

    }

    ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH);

err_out:

    close(fd);

    return ret;

}

    ret = fchmod(fd, credp->fc_mode & 07777);     ret = fchownat(fd, "", credp->fc_uid, credp->fc_gid, AT_EMPTY_PATH);
static int FUNC_0(int VAR_0, const char *VAR_1, FsCred *VAR_2)

{

    int VAR_3, VAR_4;

    VAR_3 = openat(VAR_0, VAR_1, O_NONBLOCK | O_NOFOLLOW);

    if (VAR_3 < 0) {

        return VAR_3;

    }

    VAR_4 = fchmod(VAR_3, VAR_2->fc_mode & 07777);

    if (VAR_4 < 0) {

        goto err_out;

    }

    VAR_4 = fchownat(VAR_3, "", VAR_2->fc_uid, VAR_2->fc_gid, AT_EMPTY_PATH);

err_out:

    close(VAR_3);

    return VAR_4;

}

static int FUNC_0(int VAR_0, const char *VAR_1, FsCred *VAR_2)
{ int VAR_3, VAR_4; VAR_3 = openat(VAR_0, VAR_1, O_NONBLOCK | O_NOFOLLOW); if (VAR_3 < 0) { return VAR_3; } VAR_4 = fchmod(VAR_3, VAR_2->fc_mode & 07777); if (VAR_4 < 0) { goto err_out; } VAR_4 = fchownat(VAR_3, "", VAR_2->fc_uid, VAR_2->fc_gid, AT_EMPTY_PATH); err_out:
close(VAR_3); return VAR_4; }