summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 15:12:58 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 15:30:04 +0100
commitef4241da48a95f0a90cbe79f0d0f7d7f2887c40c (patch)
tree261ec18ebfe3f71d842a92112c5b68827f82e39d /tests
parentc64eea6eac7fd4c48fcf8e64636765a1f4e4e03b (diff)
jittertest: fix error check for open system call
The value 0 is a valid file descriptor. The existing error handling would not only treat that as an error, but subsequently leak the file descriptor in the error handling path. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/jittertest/JitterTest.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/jittertest/JitterTest.c b/tests/jittertest/JitterTest.c
index e109995..797035b 100644
--- a/tests/jittertest/JitterTest.c
+++ b/tests/jittertest/JitterTest.c
@@ -462,14 +462,14 @@ static void doGrabKProfile(int jitterusec, char *fileName)
(void)jitterusec;
- if((fdSnapshot = open(fileName, O_WRONLY | O_CREAT, S_IRWXU)) <= 0)
+ if((fdSnapshot = open(fileName, O_WRONLY | O_CREAT, S_IRWXU)) < 0)
{
fprintf(stderr, "Could not open file %s.\n", fileName);
perror("Error:");
return;
}
- if((fdProfile = open("/proc/profile", O_RDWR)) <= 0)
+ if((fdProfile = open("/proc/profile", O_RDWR)) < 0)
{
fprintf(stderr, "Could not open file /proc/profile. Make sure you booted with profile=2\n");
close(fdSnapshot);
@@ -509,7 +509,7 @@ static void clearProfileBuf(void){
char readBuf[10];
- if((fdProfile = open("/proc/profile", O_RDWR)) <= 0)
+ if((fdProfile = open("/proc/profile", O_RDWR)) < 0)
{
fprintf(stderr, "Could not open file /proc/profile. Make sure you booted with profile=2\n");
return;