From 74a4d22078a588097f78deaa18b3909393d15e08 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 2 May 2019 12:48:05 +0200 Subject: [PATCH] hardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]] MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit misc-utils/hardlink.c: In function ‘process_path’: misc-utils/hardlink.c:287:30: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare] misc-utils/hardlink.c: In function ‘main’: misc-utils/hardlink.c:455:5: warning: ‘exclude_pattern’ may be used uninitialized in this function [-Wmaybe-uninitialized] Signed-off-by: Karel Zak --- misc-utils/hardlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c index 3354273cbd..4acd8d7e6a 100644 --- a/misc-utils/hardlink.c +++ b/misc-utils/hardlink.c @@ -283,8 +283,8 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) for (fsize = st.st_size; fsize > 0; fsize -= (off_t)sizeof(ctl->iobuf1)) { ssize_t xsz; - ssize_t rsize = fsize > (ssize_t)sizeof(ctl->iobuf1) ? - sizeof(ctl->iobuf1) : fsize; + ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ? + (ssize_t) sizeof(ctl->iobuf1) : fsize; if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) warn(_("cannot read %s"), name); @@ -393,7 +393,7 @@ int main(int argc, char **argv) int errornumber; PCRE2_SIZE erroroffset; pcre2_code *re; - PCRE2_SPTR exclude_pattern; + PCRE2_SPTR exclude_pattern = NULL; pcre2_match_data *match_data; #endif struct hardlink_dynstr nam1 = { NULL, 0 }; -- 2.47.2