Re: Range checks of pg_test_fsync --secs-per-test and pg_test_timing --duration
От | Peter Eisentraut |
---|---|
Тема | Re: Range checks of pg_test_fsync --secs-per-test and pg_test_timing --duration |
Дата | |
Msg-id | 4d4867ca-41fe-d95e-3b82-24818b508847@2ndquadrant.com обсуждение исходный текст |
Ответ на | Range checks of pg_test_fsync --secs-per-test and pg_test_timing --duration (Michael Paquier <michael@paquier.xyz>) |
Ответы |
Re: Range checks of pg_test_fsync --secs-per-test and pg_test_timing --duration
|
Список | pgsql-hackers |
On 2020-08-06 08:27, Michael Paquier wrote: > As $subject says, pg_test_fsync and pg_test_timing don't really check > the range of option values specified. It is possible for example to > make pg_test_fsync run an infinite amount of time, and pg_test_timing > does not handle overflows with --duration at all. > > These are far from being critical issues, but let's fix them at least > on HEAD. So, please see the attached, where I have also added some > basic TAP tests for both tools. According to the POSIX standard, atoi() is not required to do any error checking, and if you want error checking, you should use strtol(). And if you do that, you might as well change the variables to unsigned and use strtoul(), and then drop the checks for <=0. I would allow 0. It's not very useful, but it's not harmful and could be applicable in testing. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: