diff options
author | Clark Williams <clark.williams@gmail.com> | 2020-10-27 20:41:31 +0000 |
---|---|---|
committer | Clark Williams <clark.williams@gmail.com> | 2020-10-27 20:41:31 +0000 |
commit | ca0cac141016b1b080de84feca2e5147f865caa5 (patch) | |
tree | 14d625ab41dfa3be1189d96c29dbd99ec3a748d9 | |
parent | c35b62722ffebb3cf16ad6b470d9275f007f6fa2 (diff) | |
parent | 6c4025b9e28e4a4446b24b128849a679a1053af8 (diff) | |
download | stalld-ca0cac141016b1b080de84feca2e5147f865caa5.tar.gz |
Merge branch 'fixes' into 'master'
return value check fixes
See merge request rt-linux-tools/stalld!11
-rw-r--r-- | src/stalld.c | 2 | ||||
-rw-r--r-- | src/throttling.c | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/stalld.c b/src/stalld.c index 196836b..ebcad00 100644 --- a/src/stalld.c +++ b/src/stalld.c @@ -106,7 +106,7 @@ int read_sched_debug(char *buffer, int size) do { retval = read(fd, &buffer[position], size - position); - if (read < 0) + if (retval < 0) goto out_close_fd; position += retval; diff --git a/src/throttling.c b/src/throttling.c index 3cf716f..69c1ba9 100644 --- a/src/throttling.c +++ b/src/throttling.c @@ -36,6 +36,7 @@ static long rt_runtime_us = 0; static void restore_rt_throttling(int status, void *arg) { + int retval; if (rt_runtime_us != -1) { int fd = open(RT_RUNTIME_PATH, O_WRONLY); char buffer[80]; @@ -43,7 +44,10 @@ static void restore_rt_throttling(int status, void *arg) if (fd < 0) die("restore_rt_throttling: failed to open %s\n", RT_RUNTIME_PATH); sprintf(buffer, "%ld", rt_runtime_us); - write(fd, buffer, strlen(buffer)); + retval = write(fd, buffer, strlen(buffer)); + if (retval < 0) + warn("restore_rt_throttling: error restoring rt throttling"); + close(fd); log_msg("RT Throttling runtime restored to %d\n", rt_runtime_us); } |