From: Andreas Schneider Date: Wed, 21 Mar 2018 11:49:38 +0000 (+0100) Subject: lib:util: Fix size types in fgets_slash() X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=bc3834d6910c71159ee5e6dc3b04475706d9e846 lib:util: Fix size types in fgets_slash() This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index b78252316c80..7b96a595d437 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -352,7 +352,7 @@ const char **str_list_make_v3_const(TALLOC_CTX *mem_ctx, */ _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint); -char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f); +char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, size_t maxlen, FILE *f); /** load a file into memory from a fd. diff --git a/lib/util/util_file.c b/lib/util/util_file.c index 499e8c466939..bf2f3e1a27f4 100644 --- a/lib/util/util_file.c +++ b/lib/util/util_file.c @@ -79,10 +79,10 @@ _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint) return data; } -char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, int maxlen, FILE *f) +char *fgets_slash(TALLOC_CTX *mem_ctx, char *s2, size_t maxlen, FILE *f) { char *s = s2; - int len = 0; + size_t len = 0; int c; bool start_of_line = true;