1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ping_pong: Validate num_locks argument > 0

This fixes the floating point error if num_locks = 0.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 16afe36de52561a62372c14b567683dc898369d5)
This commit is contained in:
Amitay Isaacs 2013-07-04 17:37:05 +10:00
parent cc3ffdbc1a
commit cc6772c968

View File

@ -237,6 +237,10 @@ int main(int argc, char *argv[])
fname = argv[0]; fname = argv[0];
num_locks = atoi(argv[1]); num_locks = atoi(argv[1]);
if (num_locks <= 0) {
printf("num_locks should be > 0\n");
exit(1);
}
fd = open(fname, O_CREAT|O_RDWR, 0600); fd = open(fname, O_CREAT|O_RDWR, 0600);
if (fd == -1) exit(1); if (fd == -1) exit(1);