From b1486b332a3242199bf239512d34596461c8e9f2 Mon Sep 17 00:00:00 2001 From: Wojciech Andralojc Date: Mon, 6 Aug 2018 13:43:02 +0100 Subject: [PATCH] Fix for CI error in test code on epel6 platform. Signed-off-by: Wojciech Andralojc Change-Id: I325ea0728dd1eb65776f239b0d7977cc02f9c8db --- src/utils_proc_pids_test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils_proc_pids_test.c b/src/utils_proc_pids_test.c index b7e6c3b2..e9571f2c 100644 --- a/src/utils_proc_pids_test.c +++ b/src/utils_proc_pids_test.c @@ -56,6 +56,7 @@ static const char *proc_fs = "/tmp/procfs_stub"; * 0 on success. * -1 on base dir creation error. * -2 on comm file creation error. + * -3 on comm file write error. */ int stub_procfs_setup(const stub_proc_pid_t *proc_pids_array, const size_t proc_pids_array_length) { @@ -73,9 +74,13 @@ int stub_procfs_setup(const stub_proc_pid_t *proc_pids_array, FILE *fp = fopen(path, "w"); if (!fp) return -2; - fwrite(proc_pids_array[i].comm, sizeof(char), - strlen(proc_pids_array[i].comm), fp); + + size_t slen = strlen(proc_pids_array[i].comm); + size_t wlen = fwrite(proc_pids_array[i].comm, sizeof(char), slen, fp); fclose(fp); + + if (slen != wlen) + return -3; } return 0; } -- 2.11.0