-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not return error from -i when no interfaces are configured #17
Conversation
resolvconf.in
Outdated
@@ -444,6 +444,7 @@ list_resolv() | |||
list= | |||
report=false | |||
retval=0 | |||
pattern_specified="$1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should appear after the shift above as that's where the parameters to variables assignment happens.
Maybe add some whitespace between the non parameter assignments too.
5b2d85a
to
7d618c2
Compare
resolvconf.in
Outdated
@@ -523,7 +525,8 @@ list_resolv() | |||
fi | |||
|
|||
cd "$IFACEDIR" | |||
retval=1 | |||
retval=0 | |||
[ -n "$pattern_specified" ] && retval=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be more clear as to the intent.
Can you change this to somthing like this please?
# Return an error only if we have a pattern to match with no results
if [ -n "pattern_specified" ]; then
retval=1
else
retval=0
fi
This also reduces the number of assignments on the more common path of supplying a pattern.
The -i and -l options have an optional pattern argument, and it makes sense to return an error when the pattern does not match. However, when no pattern is specified and no interface is configured an error is returned as well. This makes it problematic to detect if -i option is supported - an error is returned both when the option is not supported by other resolvconf implementation, and when there are no interfaces configured in openresolv. Signed-off-by: Michal Suchanek <[email protected]>
Thanks for the patch! |
Fixes a regression introduced in #17 which in turn broke the main operationm of resolvconf. I should have tested this better.
Thhe -i and -l options have an optional pattern argument, and it makes sense to return an error when the pattern does not match.
However, when no pattern is specified and no interface is configured an error is returned as well.
This makes it problematic to detect if -i option is supported - an error is returned both when the option is not supported by other resolvconf implementation, and when there are no interfaces configured in openresolv.