File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -966,7 +966,7 @@ fill_core_tab(char *str)
966966 * p = '\0' ;
967967
968968 cos = (unsigned )strtouint64 (str );
969- n = strlisttotabrealloc (p + 1 , & cores , & max_cores_count );
969+ n = strlisttotab (p + 1 , cores , max_cores_count );
970970
971971 if (n == 0 )
972972 goto normal_exit ;
Original file line number Diff line number Diff line change 4444#include "profiles.h"
4545
4646#include <ctype.h> /**< isspace() */
47+ #include <errno.h>
4748#include <fcntl.h>
4849#include <getopt.h> /**< getopt_long() */
4950#include <limits.h>
@@ -187,8 +188,20 @@ strtouint64_base(const char *s, int default_base)
187188 s += 2 ;
188189 }
189190
191+ errno = 0 ;
190192 n = strtoull (s , & endptr , base );
191193
194+ /* Check for various possible errors */
195+ if ((errno == ERANGE && n == ULLONG_MAX ) || (errno != 0 && n == 0 )) {
196+ perror ("strtoull" );
197+ exit (EXIT_FAILURE );
198+ }
199+
200+ if (endptr == s ) {
201+ printf ("No digits were found\n" );
202+ exit (EXIT_FAILURE );
203+ }
204+
192205 if (!(* s != '\0' && * endptr == '\0' )) {
193206 printf ("Error converting '%s' to unsigned number!\n" , str );
194207 exit (EXIT_FAILURE );
You can’t perform that action at this time.
0 commit comments