* [LTP] [PATCH] API/CGroups: Remove TEST macro use from library
2021-06-04 13:41 [LTP] [PATCH] API/CGroups: Remove TEST macro use from library Richard Palethorpe
@ 2021-06-04 13:25 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2021-06-04 13:25 UTC (permalink / raw)
To: ltp
Hi!
Huh, this is subset of the pach in the RFC I'm just started to look at.
I guess that we can apply the RFC patch "Add scripts to remove TEST in
library" or do you want to send split into several pieces?
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
* [LTP] [PATCH] API/CGroups: Remove TEST macro use from library
@ 2021-06-04 13:41 Richard Palethorpe
2021-06-04 13:25 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Richard Palethorpe @ 2021-06-04 13:41 UTC (permalink / raw)
To: ltp
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
lib/tst_cgroup.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
index 6d94ea41c..2b99c81a4 100644
--- a/lib/tst_cgroup.c
+++ b/lib/tst_cgroup.c
@@ -1073,6 +1073,7 @@ ssize_t safe_cgroup_read(const char *const file, const int lineno,
const char *alias;
size_t prev_len = 0;
char prev_buf[BUFSIZ];
+ ssize_t read_ret = 0;
for_each_dir(cg, cfile->ctrl_indx, dir) {
if (!(alias = cgroup_file_alias(cfile, *dir)))
@@ -1081,9 +1082,9 @@ ssize_t safe_cgroup_read(const char *const file, const int lineno,
if (prev_len)
memcpy(prev_buf, out, prev_len);
- TEST(safe_file_readat(file, lineno,
- (*dir)->dir_fd, alias, out, len));
- if (TST_RET < 0)
+ read_ret = safe_file_readat(file, lineno,
+ (*dir)->dir_fd, alias, out, len);
+ if (read_ret < 0)
continue;
if (prev_len && memcmp(out, prev_buf, prev_len)) {
@@ -1093,12 +1094,12 @@ ssize_t safe_cgroup_read(const char *const file, const int lineno,
break;
}
- prev_len = MIN(sizeof(prev_buf), (size_t)TST_RET);
+ prev_len = MIN(sizeof(prev_buf), (size_t)read_ret);
}
- out[MAX(TST_RET, 0)] = '\0';
+ out[MAX(read_ret, 0)] = '\0';
- return TST_RET;
+ return read_ret;
}
void safe_cgroup_printf(const char *const file, const int lineno,
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-04 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-04 13:41 [LTP] [PATCH] API/CGroups: Remove TEST macro use from library Richard Palethorpe
2021-06-04 13:25 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox