From: Karel Zak Date: Thu, 2 May 2019 10:48:05 +0000 (+0200) Subject: hardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]] X-Git-Tag: v2.34-rc2~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74a4d22078a588097f78deaa18b3909393d15e08;p=thirdparty%2Futil-linux.git hardlink: fix compiler warnings [-Wsign-compare -Wmaybe-uninitialized]] 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 --- 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 };