-
Notifications
You must be signed in to change notification settings - Fork 210
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
Race condition in agent/snmpd.c #157
Comments
Thank you for having reported this. A candidate fix has been posted on the net-snmp-coders mailing list and also has been attached to this comment. Please help testing and/or upvoting this patch. |
The fix amends the problem. |
bvanassche
added a commit
that referenced
this issue
Aug 14, 2020
From https://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html: "The fclose() function shall perform the equivalent of a close() on the file descriptor that is associated with the stream pointed to by stream." Hence call fclose() but not close() if fdopen() succeeded. See also #157 . Fixes: fd9a42d ("- (pass-persist.c pass-persist.h): moved to pass_persist.[ch].") Fixes: a36188e ("Patch #760417 from Bob Rowlands/Sun for fixing Bug #751920")
A fix has been applied on the v5.9 and master branches. See also commit 26c1d4f. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When snmpd is creating a pid file, code uses a sequence
open()/fdopen()/fclose()/close()
, butclose()
is unnecessary whenfclose()
was successful :fdopen: .... The file descriptor is not dup'ed, and will be closed when the stream created by fdopen() is closed.
And if one has an active thread, that tries to open socket/file, it could obtain after call to
fclose()
the samefd
, that will be closed byclose()
.In my case I/O thread of zeromq called
abort()
when had encountered this situation.The text was updated successfully, but these errors were encountered: