From d8fbbcfa1036dc8ae6967305d9639b7ceb99763d Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Thu, 21 Sep 2000 16:22:41 +0000 Subject: [PATCH] * rc_io.h (struct krb5_rc_iostuff): Internal structure - change position in file from long to off_t (as argument for lseek). * rc_io.c (krb5_rc_io_read, krb5_rc_io_write): Unsigned vs signed warnings cleanup. * rc_dfl.c (alive): Do not shadow time() with variable named for same. * rc_base.c (krb5_rc_resolve_full): Cleanup unsigned vs. signed warnings. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12663 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/ChangeLog | 14 ++++++++++++++ src/lib/krb5/rcache/rc_base.c | 6 ++++-- src/lib/krb5/rcache/rc_dfl.c | 8 ++++---- src/lib/krb5/rcache/rc_io.c | 8 ++++---- src/lib/krb5/rcache/rc_io.h | 6 +++--- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index 3bac09193..9fa3733ef 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,17 @@ +2000-09-21 Ezra Peisach + + * rc_io.h (struct krb5_rc_iostuff): Internal structure - change + position in file from long to off_t (as argument for lseek). + + * rc_io.c (krb5_rc_io_read, krb5_rc_io_write): Unsigned vs signed + warnings cleanup. + + * rc_dfl.c (alive): Do not shadow time() with variable named for same. + + * rc_base.c (krb5_rc_resolve_full): Cleanup unsigned vs. signed + warnings. + + 2000-06-29 Ezra Peisach * rc_io.c (krb5_rc_io_creat): Cast getpid() to int. diff --git a/src/lib/krb5/rcache/rc_base.c b/src/lib/krb5/rcache/rc_base.c index bc878b592..c24f2ebad 100644 --- a/src/lib/krb5/rcache/rc_base.c +++ b/src/lib/krb5/rcache/rc_base.c @@ -138,13 +138,15 @@ krb5_error_code krb5_rc_resolve_full(context, id, string_name) char *type; char *residual; krb5_error_code retval; + unsigned int diff; if (!(residual = strchr(string_name,':'))) return KRB5_RC_PARSE; - if (!(type = malloc(residual - string_name + 1))) + diff = residual - string_name; + if (!(type = malloc(diff + 1))) return KRB5_RC_MALLOC; - (void) strncpy(type,string_name,residual - string_name); + (void) strncpy(type, string_name, diff); type[residual - string_name] = '\0'; if (!(*id = (krb5_rcache) malloc(sizeof(**id)))) { diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index a86f42e71..cc046e782 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -93,11 +93,11 @@ static int alive(context, new, t) krb5_donot_replay *new; krb5_deltat t; { - krb5_int32 time; + krb5_int32 mytime; - if (krb5_timeofday(context, &time)) + if (krb5_timeofday(context, &mytime)) return CMP_HOHUM; /* who cares? */ - if (new->ctime + t < time) /* I hope we don't have to worry about overflow */ + if (new->ctime + t < mytime) /* I hope we don't have to worry about overflow */ return CMP_EXPIRED; return CMP_HOHUM; } @@ -481,7 +481,7 @@ krb5_rc_io_store (context, t, rep) struct dfl_data *t; krb5_donot_replay *rep; { - int clientlen, serverlen, len; + unsigned int clientlen, serverlen, len; char *buf, *ptr; krb5_error_code ret; diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index 3706a66ee..549788f52 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -46,7 +46,7 @@ extern int errno; /* this should be in errno.h, but isn't on some systems */ #define FREE(x) ((void) free((char *) (x))) #define UNIQUE getpid() /* hopefully unique number */ -static int dirlen = 0; +static unsigned int dirlen = 0; static char *dir; /* The do ... while(0) is required to insure that GETDIR looks like a @@ -282,7 +282,7 @@ krb5_error_code krb5_rc_io_write (context, d, buf, num) krb5_context context; krb5_rc_iostuff *d; krb5_pointer buf; - int num; + unsigned int num; { if (write(d->fd,(char *) buf,num) == -1) switch(errno) @@ -320,7 +320,7 @@ krb5_error_code krb5_rc_io_read (context, d, buf, num) krb5_context context; krb5_rc_iostuff *d; krb5_pointer buf; - int num; + unsigned int num; { int count; if ((count = read(d->fd,(char *) buf,num)) == -1) @@ -367,7 +367,7 @@ krb5_error_code krb5_rc_io_mark (context, d) krb5_context context; krb5_rc_iostuff *d; { - d->mark = lseek(d->fd,0,SEEK_CUR); /* can't fail */ + d->mark = lseek(d->fd,(off_t) 0,SEEK_CUR); /* can't fail */ return 0; } diff --git a/src/lib/krb5/rcache/rc_io.h b/src/lib/krb5/rcache/rc_io.h index aa909614c..8a1c241c7 100644 --- a/src/lib/krb5/rcache/rc_io.h +++ b/src/lib/krb5/rcache/rc_io.h @@ -19,7 +19,7 @@ typedef struct krb5_rc_iostuff #ifdef MSDOS_FILESYSTEM long mark; #else - int mark; /* on newer systems, should be pos_t */ + off_t mark; /* on newer systems, should be pos_t */ #endif char *fn; } @@ -43,12 +43,12 @@ krb5_error_code krb5_rc_io_write PROTOTYPE((krb5_context, krb5_rc_iostuff *, krb5_pointer, - int)); + unsigned int)); krb5_error_code krb5_rc_io_read PROTOTYPE((krb5_context, krb5_rc_iostuff *, krb5_pointer, - int)); + unsigned int)); krb5_error_code krb5_rc_io_close PROTOTYPE((krb5_context, krb5_rc_iostuff *)); -- 2.26.2