mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-27 18:23:00 -04:00
fix: use errno instead of getsockopt return value for strerror
getsockopt() returns -1 on error, not an errno value. The actual error code is stored in errno. Using strerror(retval) with retval=-1 gives incorrect error messages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -231,7 +231,7 @@ int RemoteCameraHttp::ReadData(Buffer &buffer, unsigned int bytes_expected) {
|
||||
socklen_t len = sizeof(error);
|
||||
int retval = getsockopt(sd, SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
if (retval != 0) {
|
||||
Debug(1, "error getting socket error code %s", strerror(retval));
|
||||
Debug(1, "error getting socket error code %s", strerror(errno));
|
||||
}
|
||||
if (error != 0) {
|
||||
return -1;
|
||||
@@ -263,7 +263,7 @@ int RemoteCameraHttp::ReadData(Buffer &buffer, unsigned int bytes_expected) {
|
||||
socklen_t len = sizeof(error);
|
||||
int retval = getsockopt(sd, SOL_SOCKET, SO_ERROR, &error, &len);
|
||||
if (retval != 0) {
|
||||
Debug(1, "error getting socket error code %s", strerror(retval));
|
||||
Debug(1, "error getting socket error code %s", strerror(errno));
|
||||
}
|
||||
if (error != 0) {
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user