From: Kevin Day Date: Fri, 21 Aug 2020 03:34:04 +0000 (-0500) Subject: Bugfix: file change role invalid parameter on < -1. X-Git-Tag: 0.5.0~43 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=18fe3f95e7538365b4ba8b703b404117ed9507d4;p=fll Bugfix: file change role invalid parameter on < -1. Having tests for "< -1" resulted in false positives for invalid parameters. It appears that the uid_t and gid_t types are unsigned. The value -1 is simply a special case use. --- diff --git a/level_0/f_file/c/file.c b/level_0/f_file/c/file.c index b57f85a..9a61073 100644 --- a/level_0/f_file/c/file.c +++ b/level_0/f_file/c/file.c @@ -1513,8 +1513,7 @@ extern "C" { f_return_status f_file_role_change(const f_string path, const uid_t uid, const gid_t gid, const bool dereference) { #ifndef _di_level_0_parameter_checking_ if (path == 0) return F_status_set_error(F_parameter); - if (uid < 0 && gid < 0) return F_status_set_error(F_parameter); - if (uid < -1 || gid < -1) return F_status_set_error(F_parameter); + if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_role_change(path, uid, gid, dereference); @@ -1525,8 +1524,7 @@ extern "C" { f_return_status f_file_role_change_at(const int at_id, const f_string path, const uid_t uid, const gid_t gid, const int flag) { #ifndef _di_level_0_parameter_checking_ if (path == 0) return F_status_set_error(F_parameter); - if (uid < 0 && gid < 0) return F_status_set_error(F_parameter); - if (uid < -1 || gid < -1) return F_status_set_error(F_parameter); + if (uid == -1 && gid == -1) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ return private_f_file_role_change_at(at_id, path, uid, gid, flag);