* lib/tcbfuncs.c: Avoid implicit signed to unsigned conversions.

This commit is contained in:
nekral-guest 2010-03-18 00:03:48 +00:00
parent 1d969818fd
commit 37b4c8737f
2 changed files with 4 additions and 3 deletions

View File

@ -14,6 +14,7 @@
* lib/tcbfuncs.c: Include shadowio.h, needed for the * lib/tcbfuncs.c: Include shadowio.h, needed for the
spw_setdbname's prototype. spw_setdbname's prototype.
* lib/tcbfuncs.c: Ignore fflush() return value. * lib/tcbfuncs.c: Ignore fflush() return value.
* lib/tcbfuncs.c: Avoid implicit signed to unsigned conversions.
2010-03-17 Nicolas François <nicolas.francois@centraliens.net> 2010-03-17 Nicolas François <nicolas.francois@centraliens.net>

View File

@ -101,7 +101,7 @@ static char *shadowtcb_path_rel_existing(const char *name)
char *path, *rval; char *path, *rval;
struct stat st; struct stat st;
char link[8192]; char link[8192];
int ret; ssize_t ret;
if (asprintf(&path, TCB_DIR "/%s", name) == -1) { if (asprintf(&path, TCB_DIR "/%s", name) == -1) {
OUT_OF_MEMORY; OUT_OF_MEMORY;
@ -133,12 +133,12 @@ static char *shadowtcb_path_rel_existing(const char *name)
return NULL; return NULL;
} }
free(path); free(path);
if (ret >= sizeof(link) - 1) { if ((size_t)ret >= sizeof(link) - 1) {
link[sizeof(link) - 1] = '\0'; link[sizeof(link) - 1] = '\0';
fprintf(stderr, _("%s: Suspiciously long symlink: %s\n"), Prog, link); fprintf(stderr, _("%s: Suspiciously long symlink: %s\n"), Prog, link);
return NULL; return NULL;
} }
link[ret] = '\0'; link[(size_t)ret] = '\0';
rval = strdup(link); rval = strdup(link);
if (NULL == rval) { if (NULL == rval) {
OUT_OF_MEMORY; OUT_OF_MEMORY;