From: Kevin Day Date: Sun, 27 Feb 2022 23:22:06 +0000 (-0600) Subject: Update: Relax the uid/gid requirements in f_file_role_change* functions. X-Git-Tag: 0.5.9~117 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c0c4bd7f34ceb641e9798db7e43d2f942cfd7c00;p=fll Update: Relax the uid/gid requirements in f_file_role_change* functions. Be less picky. If both ID's are not available, then return F_data_not rather than an error. --- diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index 513d1a4..e5a60ac 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1770,11 +1770,8 @@ extern "C" { #ifndef _di_f_file_role_change_ f_status_t f_file_role_change(const f_string_static_t path, const uid_t uid, const gid_t gid, const bool dereference) { - #ifndef _di_level_0_parameter_checking_ - if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - if (!path.used) { + if (uid == -1 && gid == -1 || !path.used) { return F_data_not; } @@ -1784,9 +1781,10 @@ extern "C" { #ifndef _di_f_file_role_change_at_ f_status_t f_file_role_change_at(const int at_id, const f_string_static_t path, const uid_t uid, const gid_t gid, const int flag) { - #ifndef _di_level_0_parameter_checking_ - if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ + + if (uid == -1 && gid == -1) { + return F_data_not; + } return private_f_file_role_change_at(at_id, path, uid, gid, flag); } diff --git a/level_0/f_file/c/file.h b/level_0/f_file/c/file.h index 7075dc4..73c4b65 100644 --- a/level_0/f_file/c/file.h +++ b/level_0/f_file/c/file.h @@ -1648,8 +1648,6 @@ extern "C" { /** * Change owner and/or group of a given file at the specified path. * - * At least one of uid or gid must not be -1. - * * @param path * The path file name. * @param uid @@ -1664,6 +1662,7 @@ extern "C" { * * @return * F_none on success. + * F_data_not if either both uid and gid are -1 or path.used is 0. * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group. @@ -1689,8 +1688,6 @@ extern "C" { /** * Change owner and/or group of a given file at the specified path. * - * At least one of uid or gid must not be -1. - * * @param at_id * The parent directory, as an open directory file descriptor, in which path is relative to. * @param path @@ -1706,6 +1703,7 @@ extern "C" { * * @return * F_none on success. + * F_data_not if either both uid and gid are -1 or path.used is 0. * * F_access_denied (with error bit) on access denied. * F_access_group (with error bit) if the current user does not have access to assign the specified group.