Skip to content

Commit 14dd68f

Browse files
committed
Fix a -Wformat-truncation warning with gcc-8
Change-Id: I84014cdcdce7152263701f720ef8363224d74596
1 parent 3cd824d commit 14dd68f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lib/tng_io.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -15176,19 +15176,21 @@ tng_function_status DECLSPECDLLEXPORT tng_time_get_str
1517615176
{
1517715177
struct tm *time_data;
1517815178
time_t secs;
15179+
int retval;
1517915180

1518015181
TNG_ASSERT(tng_data, "TNG library: Trajectory container not properly setup.");
1518115182
TNG_ASSERT(time, "TNG library: time must not be a NULL pointer");
1518215183

1518315184
secs = tng_data->time;
1518415185

1518515186
time_data = localtime(&secs); /* Returns a statically allocated variable. */
15186-
TNG_SNPRINTF(time, TNG_MAX_DATE_STR_LEN,
15187+
retval = TNG_SNPRINTF(time, TNG_MAX_DATE_STR_LEN,
1518715188
"%4d-%02d-%02d %02d:%02d:%02d",
1518815189
time_data->tm_year+1900, time_data->tm_mon+1, time_data->tm_mday,
1518915190
time_data->tm_hour, time_data->tm_min, time_data->tm_sec);
1519015191

15191-
return(TNG_SUCCESS);
15192+
/* handle return value (also) to quiet a -Wformat-truncation warning */
15193+
return( (retval < 0) ? TNG_SUCCESS : TNG_FAILURE );
1519215194
}
1519315195

1519415196

0 commit comments

Comments
 (0)