From: Linus Torvalds <[email protected]> Date: Thu, 14 Sep 2017 11:06:46 -0700 Subject: [PATCH] xml: save the right sensor pressure when we have multiple sensor readings
The XML saving code got the multi-sensor case completely wrong, because it still had one place where it would always save the first pressure, rather than the pressure from the right sensor. This was hidden by the fact that old data would be saved using the legacy model that only ever used the first sensor slot. Only if you actually had multiple sensor slots used would the bug trigger. Signed-off-by: Linus Torvalds <[email protected]> --- This is a serious saving bug if you use the XML format, but it would be hidden by the fact that you'd have to have a newly downloaded dive with actual multiple sensors, because loading of old XML dives would never trigger it, and the single-sensor case also doesn't show it. So in practice probably nobody actually hit this, but in theory it's a major data loss. core/save-xml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/save-xml.c b/core/save-xml.c index df6b99eb..d3b9e6c8 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -220,7 +220,7 @@ static void save_sample(struct membuffer *b, struct sample *sample, struct sampl put_pressure(b, p, " o2pressure='", " bar'"); continue; } - put_pressure(b, sample->pressure[0], " pressure='", " bar'"); + put_pressure(b, p, " pressure='", " bar'"); if (sensor != old->sensor[0]) { put_format(b, " sensor='%d'", sensor); old->sensor[0] = sensor; -- 2.14.1.538.gc8f31819a _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
