Skip to content

Commit

Permalink
Print warnings/errors when numerical parameters cannot be parsed
Browse files Browse the repository at this point in the history
Using the atoi method is a best effort method that parses as much of the
input string as possible as integer and ignores the rest or return 0
if the string cannot be parsed. This is lead to unexpected results.

Change the behaviour by printing a warning in these cases instead. When
parsing a configuration, these warnings will error out since the msglevel
is M_USAGE in this case. Example:

    ./src/openvpn/openvpn --resolv-retry 198jj
    Options error: Cannot parse argument '198jj' as non-negative integer

Reported-By: Anqi Chen <[email protected]>
Reported-By: Cristina Nita-Rotaru <[email protected]>
Change-Id: Ie1e2eb54d516b3ae87c5ca56fe8edd77ee2be4de
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Gert Doering <[email protected]>
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg30627.html
Signed-off-by: Gert Doering <[email protected]>
  • Loading branch information
schwabe authored and cron2 committed Jan 27, 2025
1 parent d9af13e commit 40518dc
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 82 deletions.
Loading

0 comments on commit 40518dc

Please sign in to comment.