[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 18 Aug 2022 16:06:20 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EnR5qRwNw6zZzjgoQj3V3iV07Z5cVrIBB47eHQXTWkU=; b=VTtEtFfHQBc5dqoXlhMemFEzz0Iy88kt6qAZoAPiO+BGMvABRKUG8YAfOVjknYlQUT+qZwxv1bTfcBHpWUscyjYc9thBIlkZ/WzX8ArjdCo7s2iWb0PaUXNguFX53WMTGBMfbAHyj1VcZ5iYVrG/ruvaYpcqXOzjtjT1CQw2UTfc+6qENYfj7pAfQaR+I+/9YPbBXYkj4xZXeLjmj3STNKY31TdBnj0KQoZgnyvFOmhnnVQ7K6c5aNlA/ByvFBdp7iKWots4y9r7VQugzdx61t6q1LDg49OgNilQrIcyQ/c1GKmdtS9+EFMT4QgG7kZ+5ZpcO6CfFhiSdq6bTYuthw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2p1AK7EF62m8OJjrKodptIBCsWiU411uRWnpl/PTpbOJbc1OosTgr4aDUH5s/a/Lf7095k2wusu9Z3ww1OK4PzKrMn2mWmJBQItyGPV3shhQVKmwAZOMaRS9SKwmB5xN8tTfYMVxIJtRoj1trE35qaS6OgbBoDZdzIrtzx2hbezVRzgSPdjhNvfMVGnjhjo09tdeBAHFRY7S5rFaaBGsGayHrna3D3K55Sw/aOCF3nR7d6akCZDedktp94pKWtZYZdKIi36HT/S1Mysp2Kw+Q2Csq4MSh5s6WHb9ebbT2Rbhu3RqHvkDULJPmyXwL5tPlStbETAnyUNyCJzQ6z5Sg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 18 Aug 2022 14:06:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

"int" is not a suitable type to hold time()'s return value.

Coverity ID: 1509376
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
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).

--- 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;
 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.