From 64e773800f70a4e9ebc0e606150beaff9b839fd9 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 16 Dec 2012 12:46:50 -0800 Subject: Fix some clang warnings about implicit conversions sessreg.c:360:43: warning: implicit conversion changes signedness: 'unsigned long' to 'off_t' (aka 'long') [-Wsign-conversion] sysnerr (lseek(llog, (long) pwd->pw_uid*sizeof(ll), 0) ~~~~~ ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ sessreg.c:360:25: warning: implicit conversion changes signedness: 'long' to 'unsigned long' [-Wsign-conversion] sysnerr (lseek(llog, (long) pwd->pw_uid*sizeof(ll), 0) ^~~~~~~~~~~~~~~~~~~ sessreg.c:405:7: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] i = strlen (line); ~ ^~~~~~~~~~~~~ sessreg.c:406:9: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] if (i >= sizeof (u->ut_id)) ~ ^ ~~~~~~~~~~~~~~~~~ sessreg.c:494:7: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] i = strlen (line); ~ ^~~~~~~~~~~~~ sessreg.c:495:9: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] if (i >= sizeof (u->ut_id)) ~ ^ ~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith --- sessreg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sessreg.c b/sessreg.c index 43291eb..f6c624a 100644 --- a/sessreg.c +++ b/sessreg.c @@ -357,7 +357,7 @@ main (int argc, char **argv) if (llog != -1) { struct lastlog ll; - sysnerr (lseek(llog, (long) pwd->pw_uid*sizeof(ll), 0) + sysnerr (lseek(llog, (long) (pwd->pw_uid*sizeof(ll)), 0) != -1, "seeking lastlog entry"); memset(&ll, 0, sizeof(ll)); ll.ll_time = current_time; @@ -394,7 +394,7 @@ set_utmp (struct utmp *u, char *line, char *user, char *host, time_t date, int a memset (u->ut_name, 0, sizeof (u->ut_name)); #ifdef HAVE_STRUCT_UTMP_UT_ID if (line) { - int i; + size_t i; /* * this is a bit crufty, but * follows the apparent conventions in @@ -483,7 +483,7 @@ set_utmpx (struct utmpx *u, const char *line, const char *user, memset (u->ut_user, 0, sizeof (u->ut_user)); if (line) { - int i; + size_t i; /* * this is a bit crufty, but * follows the apparent conventions in -- cgit v1.2.3