On 14/11/16 16:02, Vincent Guittot wrote:
On 11 November 2016 at 10:17, Juri Lelli juri.lelli@arm.com wrote:
[...]
@@ -274,7 +274,7 @@ void ftrace_write(int mark_fd, const char *fmt, ...)
/* If it worked return success */ if (n > -1 && n < size) {
write(mark_fd, tmp, n);
ret = write(mark_fd, tmp, n);
This remove the warning but the ret is useless, we should better loop on the write until we have written all data or an error happens
Right, something like this better?
--- src/rt-app_utils.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/src/rt-app_utils.c b/src/rt-app_utils.c index 0791291bcd81..fa574935fbaa 100644 --- a/src/rt-app_utils.c +++ b/src/rt-app_utils.c @@ -19,6 +19,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+#include <errno.h> +#include <string.h> #include "rt-app_utils.h"
unsigned long @@ -291,6 +293,11 @@ void ftrace_write(int mark_fd, const char *fmt, ...) if (n > -1 && n < size) { ret = write(mark_fd, tmp, n); free(tmp); + if (ret < 0) { + log_error("Cannot write mark_fd: %s\n", + strerror(errno)); + exit(EXIT_FAILURE); + } return; }