Skip to content

Commit

Permalink
replace LONG_MAX with max of ssize_t
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpoelen committed Oct 25, 2023
1 parent 9eef9d7 commit 908ddbc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/system/linux/system/urandom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include "utils/log.hpp"
#include "utils/random.hpp"

#include <limits>
#include <sys/random.h>


Expand All @@ -25,7 +26,7 @@ class URandom final : public Random
/* On Solaris, getrandom() is limited to returning up to 1024 bytes. */
size_t len_max = 1024;
#else
size_t len_max = LONG_MAX;
size_t len_max = std::numeric_limits<ssize_t>::max();
#endif
// TODO This is basically a blocking read, we should provide timeout management and behaviour
ssize_t n = getrandom(data, len < len_max ? len : len_max, 0);
Expand Down

0 comments on commit 908ddbc

Please sign in to comment.