Message ID | BL3PR19MB65148E663E21F7739BC39628D3272@BL3PR19MB6514.namprd19.prod.outlook.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add missing errno before strtol | expand |
On Fri, Mar 08, 2024 at 10:59:27AM +0100, Vince Ricosti wrote: > When testing yesterday the latest master on my raspberry pi I could not send > my usual file because > when entering read_file_raw the errno was already wrong (don't asky why > because this morning it works). Anyway since strtol do not update errno > except for overflow conditions it's better to set it to 0 as done in other > parts of code. > > Signed-off-by: Vince Ricosti <vricosti@outlook.com> > --- > utils/ir-ctl/ir-ctl.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c > index c480a2b1..e662651e 100644 > --- a/utils/ir-ctl/ir-ctl.c > +++ b/utils/ir-ctl/ir-ctl.c > @@ -413,6 +413,7 @@ static struct send *read_file_raw(struct arguments > *args, const char *fname, FIL > (keyword[0] == '/' && keyword[1] == '/')) > break; > + errno = 0; The formatting is all wrong, but I've fixed it up and applied it, with some minor rewording. Thanks! Sean > value = strtol(keyword, &p, 10); > if (errno || *p) { > fprintf(stderr, _("%s:%d: error: expected integer, got `%s'\n"), > > -- > 2.30.2 >
diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index c480a2b1..e662651e 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -413,6 +413,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL (keyword[0] == '/' && keyword[1] == '/')) break; + errno = 0; value = strtol(keyword, &p, 10); if (errno || *p) { fprintf(stderr, _("%s:%d: error: expected integer, got `%s'\n"),
When testing yesterday the latest master on my raspberry pi I could not send my usual file because when entering read_file_raw the errno was already wrong (don't asky why because this morning it works). Anyway since strtol do not update errno except for overflow conditions it's better to set it to 0 as done in other parts of code. Signed-off-by: Vince Ricosti <vricosti@outlook.com> --- utils/ir-ctl/ir-ctl.c | 1 + 1 file changed, 1 insertion(+)