diff mbox series

[2/3] console/client: properly use time_t in get_pty_fd()

Message ID 990f432f-1f40-04e4-dfb9-97c8db679f36@suse.com (mailing list archive)
State New, archived
Headers show
Series tools: address recently reported Coverity issues | expand

Commit Message

Jan Beulich Aug. 18, 2022, 2:06 p.m. UTC
"int" is not a suitable type to hold time()'s return value.

Coverity ID: 1509376
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
I was on the edge of switching to using difftime() at this occasion as
well. This would then also allow switching "seconds" to unsigned int (or
any other suitable unsigned type).

Comments

Anthony PERARD Aug. 18, 2022, 4:40 p.m. UTC | #1
On Thu, Aug 18, 2022 at 04:06:20PM +0200, Jan Beulich wrote:
> "int" is not a suitable type to hold time()'s return value.
> 
> Coverity ID: 1509376
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
diff mbox series

Patch

--- a/tools/console/client/main.c
+++ b/tools/console/client/main.c
@@ -102,7 +102,7 @@  static int get_pty_fd(struct xs_handle *
 	struct timeval tv;
 	fd_set watch_fdset;
 	int xs_fd = xs_fileno(xs), pty_fd = -1;
-	int start, now;
+	time_t start, now;
 	unsigned int len = 0;
 	char *pty_path, **watch_paths;