diff options
author | Amitay Isaacs <amitay@gmail.com> | 2013-07-04 17:37:05 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2013-07-04 20:43:52 +1000 |
commit | cc6772c96874b7b8c2410c073d9188c3a9c88cd9 (patch) | |
tree | 14c46a798acc6a884db81d994354e0fd5da00a7a /ctdb/utils | |
parent | cc3ffdbc1ab555e435de2c917d5128f06fad6f82 (diff) | |
download | samba-cc6772c96874b7b8c2410c073d9188c3a9c88cd9.tar.gz samba-cc6772c96874b7b8c2410c073d9188c3a9c88cd9.tar.xz samba-cc6772c96874b7b8c2410c073d9188c3a9c88cd9.zip |
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)
Diffstat (limited to 'ctdb/utils')
-rw-r--r-- | ctdb/utils/ping_pong/ping_pong.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ctdb/utils/ping_pong/ping_pong.c b/ctdb/utils/ping_pong/ping_pong.c index 0a49d6605b..16f58d8af2 100644 --- a/ctdb/utils/ping_pong/ping_pong.c +++ b/ctdb/utils/ping_pong/ping_pong.c @@ -237,6 +237,10 @@ int main(int argc, char *argv[]) fname = argv[0]; 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); if (fd == -1) exit(1); |