From 2ae890547ab92eefa31307b48676917b5fb15871 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Fri, 25 Oct 2013 10:25:42 +0200 Subject: Check that writing frequency is OK before setting it. In the high-level API return TNG_FAILURE if the specified writing frequency is <= 0. Also give an error message. In the low-level API this is silently fixed by setting it to at least 1. Fixes #1366. diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index a8f9a02..74a5228 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -14964,6 +14964,13 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_frequency_set return(stat); } + if(f <= 0) + { + printf("Cannot set writing frequency to %"PRId64". %s: %d\n", + f, __FILE__, __LINE__); + return(TNG_FAILURE); + } + frame_set = &tng_data->current_trajectory_frame_set; if(!frame_set || tng_data->n_trajectory_frame_sets <= 0) -- cgit v0.10.1