File: 0004-idlestat-fix-t-with-negative-values.patch

package info (click to toggle)
idlestat 0.8-9
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 480 kB
  • sloc: ansic: 6,539; makefile: 56
file content (33 lines) | stat: -rw-r--r-- 990 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From ac67fe5acc8f05b0a29dd43a9ce2a389abc8a51b Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Wed, 10 Jul 2019 11:37:26 +0100
Subject: [PATCH 4/5] idlestat: fix -t with negative values
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Currently using a negative -t value will run forever because duration
is an unsigned int and the check to see if it is negative is always
true because an unsigned int can never be negative.  Make duration
a signed int to fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 idlestat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/idlestat.h b/idlestat.h
index e030f6a..f06af24 100644
--- a/idlestat.h
+++ b/idlestat.h
@@ -132,7 +132,7 @@ struct trace_buffer_settings {
 struct program_options {
 	int mode;
 	int display;
-	unsigned int duration;
+	int duration;
 	struct trace_buffer_settings tbs;
 	char *filename;
 	char *baseline_filename;
-- 
2.20.1