Skip to content
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

nsupdate.sh may fail silently with exit status to be 0 #45

Closed
Gowee opened this issue Jun 25, 2021 · 0 comments
Closed

nsupdate.sh may fail silently with exit status to be 0 #45

Gowee opened this issue Jun 25, 2021 · 0 comments

Comments

@Gowee
Copy link

Gowee commented Jun 25, 2021

Hello,

I am adapting the sample hook script for Cloudflare API. I notice a possible problem that may cause the script to fail silently.

At the line

[ $res -eq 0 ] || break
, break is executed if ns_doupdate returns non-zero code. Then it flows to the line
return $?
, where $? is always 0 because previous res=$? (and [ $res -eq 0 ] ?) itself updates $? to be 0.

Finally, the script returns 0 even though ns_doupdate has failed.

A quick fix is to replace break with return $res.

(I do not have a bind server to test the original script. Please let me know if I missed something by mistake.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant