utils: fix error open() handling
CID 59376 (#2-1 of 2): Argument cannot be negative (NEGATIVE_RETURNS) negative_returns: urandom is passed to a parameter that cannot be negative.
This commit is contained in:
@@ -3416,7 +3416,7 @@ nm_utils_ipv6_addr_set_stable_privacy (struct in6_addr *addr,
|
|||||||
int urandom = open ("/dev/urandom", O_RDONLY);
|
int urandom = open ("/dev/urandom", O_RDONLY);
|
||||||
mode_t key_mask;
|
mode_t key_mask;
|
||||||
|
|
||||||
if (!urandom) {
|
if (urandom == -1) {
|
||||||
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
|
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
|
||||||
"Can't open /dev/urandom: %s", strerror (errno));
|
"Can't open /dev/urandom: %s", strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Reference in New Issue
Block a user